@opentinyvue/vue-card 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 Card from './src/index';
2
+ export default Card;
package/lib/index.js ADDED
@@ -0,0 +1,104 @@
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, $setup, $props } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileFirstTemplate from "./mobile-first.js";
13
+ import { IconEllipsis } from "@opentinyvue/vue-icon";
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 $constants = {
26
+ CARD_GROUP: "CardGroup"
27
+ };
28
+ var cardProps = _extends({}, $props, {
29
+ _constants: {
30
+ type: Object,
31
+ default: function _default() {
32
+ return $constants;
33
+ }
34
+ },
35
+ modelValue: {},
36
+ src: String,
37
+ title: String,
38
+ customClass: String,
39
+ height: String,
40
+ label: {},
41
+ autoWidth: {
42
+ type: Boolean,
43
+ default: false
44
+ },
45
+ options: {
46
+ type: Array,
47
+ default: function _default2() {
48
+ return [];
49
+ }
50
+ },
51
+ iconMore: {
52
+ type: [Object, String],
53
+ default: function _default3() {
54
+ return IconEllipsis();
55
+ }
56
+ },
57
+ size: {
58
+ type: String,
59
+ default: "medium"
60
+ },
61
+ status: {
62
+ type: String,
63
+ default: "default"
64
+ },
65
+ checkType: {
66
+ type: String,
67
+ default: ""
68
+ },
69
+ type: {
70
+ type: String,
71
+ default: "text"
72
+ },
73
+ disabled: {
74
+ type: Boolean,
75
+ default: false
76
+ },
77
+ checkMode: {
78
+ type: String,
79
+ default: "normal"
80
+ }
81
+ });
82
+ var Card = defineComponent({
83
+ name: $prefix + "Card",
84
+ props: cardProps,
85
+ setup: function setup(props, context) {
86
+ return $setup({
87
+ props,
88
+ context,
89
+ template
90
+ });
91
+ }
92
+ });
93
+ var version = "2.21.0";
94
+ Card.model = {
95
+ prop: "modelValue",
96
+ event: "update:modelValue"
97
+ };
98
+ Card.install = function(Vue) {
99
+ Vue.component(Card.name, Card);
100
+ };
101
+ Card.version = version;
102
+ export {
103
+ Card as default
104
+ };
@@ -0,0 +1,291 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/card/vue';
2
+ import { defineComponent, $prefix, props, setup } from '@opentinyvue/vue-common';
3
+ import Dropdown from '@opentinyvue/vue-dropdown';
4
+ import DropdownMenu from '@opentinyvue/vue-dropdown-menu';
5
+ import DropdownItem from '@opentinyvue/vue-dropdown-item';
6
+ import Checkbox from '@opentinyvue/vue-checkbox';
7
+ import Radio from '@opentinyvue/vue-radio';
8
+ import { IconEllipsis } from '@opentinyvue/vue-icon';
9
+
10
+ var classes = {
11
+ "card": "overflow-hidden bg-color-bg-1 border hover:shadow",
12
+ "size-large": "rounded-lg min-w-[theme(spacing.112)]",
13
+ "size-medium": "rounded-lg min-w-[theme(spacing.72)]",
14
+ "size-small": "rounded-lg min-w-[theme(spacing.54)]",
15
+ "size-mini": "rounded min-w-[theme(spacing.32)]",
16
+ "size-large-padding": "p-4",
17
+ "size-medium-padding": "p-3",
18
+ "size-small-padding": "p-3",
19
+ "size-mini-padding": "p-2",
20
+ "size-large-width": "w-144",
21
+ "size-medium-width": "w-96",
22
+ "size-small-width": "w-72",
23
+ "size-mini-width": "w-44",
24
+ "status-success": "border-color-success",
25
+ "status-warning": "border-color-warning",
26
+ "status-alerting": "border-color-alert",
27
+ "status-danger": "border-color-error",
28
+ "status-default": "border-color-border-separator",
29
+ "title": "text-base sm:text-sm mb-3 leading-5.5 text-color-text-primary mr-2",
30
+ "checkbox": "relative left-1 pt-3 sm:pt-3.5 pl-2 [&_[data-tag=tiny-checkbox]]:p-0 [&_[data-tag=tiny-checkbox]>span>span]:p-0 [&_[data-tag=tiny-checkbox]>span:nth-child(2)]:hidden",
31
+ "radio": "relative left-0 sm:left-3 pt-0 sm:pt-3 [&_[role=radio]_span_span]:pr-0",
32
+ "logo": "flex mb-3 py-2 w-full justify-center items-center aspect-[5_/_2] overflow-hidden",
33
+ "main": "text-sm sm:text-xs text-color-text-secondary overflow-y-auto",
34
+ "footer": "p-3 border-t border-t-color-border-separator",
35
+ "options": "w-full px-3 h-11 flex items-center justify-around text-color-text-primary border-t border-t-color-border-separator"
36
+ };
37
+
38
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
39
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
40
+ if (render) {
41
+ options.render = render;
42
+ options.staticRenderFns = staticRenderFns;
43
+ options._compiled = true;
44
+ }
45
+ var hook;
46
+ if (injectStyles) {
47
+ hook = injectStyles;
48
+ }
49
+ if (hook) {
50
+ if (options.functional) {
51
+ options._injectStyles = hook;
52
+ var originalRender = options.render;
53
+ options.render = function renderWithStyleInjection(h, context) {
54
+ hook.call(context);
55
+ return originalRender(h, context);
56
+ };
57
+ } else {
58
+ var existing = options.beforeCreate;
59
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
60
+ }
61
+ }
62
+ return {
63
+ exports: scriptExports,
64
+ options
65
+ };
66
+ }
67
+
68
+ var __vue2_script = defineComponent({
69
+ name: $prefix + "Card",
70
+ emits: ["icon-click", "update:modelValue", "change", "click"],
71
+ components: {
72
+ TinyDropdown: Dropdown,
73
+ TinyDropdownMenu: DropdownMenu,
74
+ TinyDropdownItem: DropdownItem,
75
+ TinyCheckbox: Checkbox,
76
+ TinyRadio: Radio,
77
+ IconEllipsis: IconEllipsis()
78
+ },
79
+ props: [].concat(props, ["_constants", "modelValue", "src", "title", "customClass", "height", "label", "autoWidth", "options", "iconMore", "size", "status", "checkType", "type", "disabled"]),
80
+ setup: function setup$1(props2, context) {
81
+ return setup({
82
+ props: props2,
83
+ context,
84
+ renderless,
85
+ api,
86
+ classes
87
+ });
88
+ }
89
+ });
90
+ var render = function render2() {
91
+ var _vm = this;
92
+ var _h = _vm.$createElement;
93
+ var _c = _vm._self._c || _h;
94
+ return _c("div", {
95
+ class: _vm.m(_vm.gcls("card"), _vm.gcls("size-" + _vm.state.size), _vm.gcls("status-" + _vm.state.status), _vm.gcls(!_vm.state.autoWidth && "size-" + _vm.state.size + "-width"), _vm.state.itemChecked ? "border-color-brand" : "", _vm.state.disabled ? "bg-color-bg-2" : "", _vm.state.customClass),
96
+ attrs: {
97
+ "data-tag": "tiny-card"
98
+ },
99
+ on: {
100
+ "click": function click($event) {
101
+ return _vm.$emit("click", $event);
102
+ }
103
+ }
104
+ }, [_c("div", {
105
+ class: [_vm.state.type === "text" ? "flex" : "block"],
106
+ attrs: {
107
+ "data-tag": "tiny-card-body"
108
+ }
109
+ }, [_vm.state.checkType === "checkbox" && _vm.state.type === "text" ? _c("div", {
110
+ class: _vm.gcls("checkbox"),
111
+ attrs: {
112
+ "data-tag": "tiny-card-checkbox"
113
+ }
114
+ }, [_c("tiny-checkbox", {
115
+ attrs: {
116
+ "label": _vm.label,
117
+ "disabled": _vm.state.disabled
118
+ },
119
+ on: {
120
+ "change": _vm.handleChange
121
+ },
122
+ model: {
123
+ value: _vm.state.model,
124
+ callback: function callback($$v) {
125
+ _vm.$set(_vm.state, "model", $$v);
126
+ },
127
+ expression: "state.model"
128
+ }
129
+ })], 1) : _vm._e(), _vm.state.checkType === "radio" && _vm.state.type === "text" ? _c("div", {
130
+ class: _vm.gcls("radio"),
131
+ attrs: {
132
+ "data-tag": "tiny-card-radio"
133
+ }
134
+ }, [_c("tiny-radio", {
135
+ attrs: {
136
+ "label": _vm.label,
137
+ "disabled": _vm.state.disabled
138
+ },
139
+ on: {
140
+ "change": _vm.handleChange
141
+ },
142
+ model: {
143
+ value: _vm.state.model,
144
+ callback: function callback($$v) {
145
+ _vm.$set(_vm.state, "model", $$v);
146
+ },
147
+ expression: "state.model"
148
+ }
149
+ }, [_c("span")])], 1) : _vm._e(), _vm.state.type === "image" ? _c("div", {
150
+ attrs: {
151
+ "data-tag": "tiny-card-image"
152
+ }
153
+ }, [_c("img", {
154
+ staticClass: "w-full aspect-video bg-cover",
155
+ attrs: {
156
+ "src": _vm.src
157
+ }
158
+ })]) : _vm._e(), _vm.state.type === "video" ? _c("div", {
159
+ attrs: {
160
+ "data-tag": "tiny-card-vadio"
161
+ }
162
+ }, [_c("video", {
163
+ staticClass: "w-full aspect-video",
164
+ attrs: {
165
+ "src": _vm.src,
166
+ "controls": ""
167
+ }
168
+ })]) : _vm._e(), _c("div", {
169
+ staticClass: "flex-1",
170
+ class: _vm.gcls("size-" + _vm.state.size + "-padding"),
171
+ attrs: {
172
+ "data-tag": "tiny-card-logo"
173
+ }
174
+ }, [_vm.state.type === "logo" ? _c("div", {
175
+ class: _vm.gcls("logo")
176
+ }, [_c("img", {
177
+ staticClass: "bg-contain",
178
+ attrs: {
179
+ "src": _vm.src
180
+ }
181
+ })]) : _vm._e(), _vm.title || _vm.slots.title ? _c("div", {
182
+ staticClass: "flex items-start",
183
+ class: [_vm.state.type === "logo" && "text-center justify-center mb-1"],
184
+ attrs: {
185
+ "data-tag": "tiny-card-title"
186
+ }
187
+ }, [_vm._t("title-left"), _vm._t("title", function() {
188
+ return [_c("p", {
189
+ class: _vm.gcls("title")
190
+ }, [_vm._v(_vm._s(_vm.title))])];
191
+ }), _vm._t("title-right")], 2) : _vm._e(), _c("div", {
192
+ class: _vm.m(_vm.gcls("main"), _vm.state.type === "logo" ? "text-center pb-2" : ""),
193
+ style: {
194
+ height: _vm.state.height
195
+ },
196
+ attrs: {
197
+ "data-tag": "tiny-card-main"
198
+ }
199
+ }, [_vm._t("default")], 2)])]), _vm.state.effectOptions.length || _vm.slots.footer ? _c("div", {
200
+ staticClass: "w-full",
201
+ attrs: {
202
+ "data-tag": "tiny-card-footer"
203
+ }
204
+ }, [_vm.slots.footer ? _c("div", {
205
+ class: _vm.gcls("footer")
206
+ }, [_vm._t("footer")], 2) : _vm._e(), _vm.state.effectOptions.length ? _c("div", {
207
+ class: _vm.gcls("options")
208
+ }, [_vm._l(_vm.state.effectOptions.slice(0, _vm.state.sliceNum), function(item, index) {
209
+ return _c("div", {
210
+ key: item.text + index,
211
+ staticClass: "cursor-pointer",
212
+ class: [item.disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
213
+ on: {
214
+ "click": function click($event) {
215
+ $event.stopPropagation();
216
+ return _vm.handelIconClick(item, index, $event);
217
+ }
218
+ }
219
+ }, [_c(item.icon, {
220
+ tag: "component",
221
+ staticClass: "w-4 h-4",
222
+ class: [item.disabled ? "fill-color-icon-disabled" : ""]
223
+ }), item.text ? _c("span", {
224
+ staticClass: "ml-1 align-middle"
225
+ }, [_vm._v(_vm._s(item.text))]) : _vm._e()], 1);
226
+ }), _vm.state.effectOptions.length === _vm.state.iconNum ? _c("div", {
227
+ staticClass: "cursor-pointer",
228
+ class: [_vm.state.effectOptions[_vm.state.sliceNum].disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
229
+ on: {
230
+ "click": function click($event) {
231
+ $event.stopPropagation();
232
+ return _vm.handelIconClick(_vm.state.effectOptions[_vm.state.sliceNum], _vm.state.sliceNum, $event);
233
+ }
234
+ }
235
+ }, [_c(_vm.state.effectOptions[_vm.state.sliceNum].icon, {
236
+ tag: "component",
237
+ staticClass: "w-4 h-4",
238
+ class: [_vm.state.effectOptions[_vm.state.sliceNum].disabled ? "fill-color-icon-disabled" : ""]
239
+ }), _vm.state.effectOptions[_vm.state.sliceNum].text ? _c("span", {
240
+ staticClass: "ml-1 align-middle"
241
+ }, [_vm._v(_vm._s(_vm.state.effectOptions[_vm.state.sliceNum].text))]) : _vm._e()], 1) : _vm._e(), _vm.state.effectOptions.length > _vm.state.iconNum ? _c("tiny-dropdown", {
242
+ attrs: {
243
+ "show-self-icon": ""
244
+ },
245
+ scopedSlots: _vm._u([{
246
+ key: "dropdown",
247
+ fn: function fn() {
248
+ return [_c("tiny-dropdown-menu", {
249
+ attrs: {
250
+ "placement": "bottom"
251
+ }
252
+ }, _vm._l(_vm.state.effectOptions.slice(_vm.state.sliceNum), function(item, index) {
253
+ return _c("tiny-dropdown-item", {
254
+ key: item.text + index
255
+ }, [_c("div", {
256
+ class: ["px-2", item.disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
257
+ on: {
258
+ "click": function click($event) {
259
+ $event.stopPropagation();
260
+ return _vm.handelIconClick(item, index + _vm.state.sliceNum, $event);
261
+ }
262
+ }
263
+ }, [_c(item.icon, {
264
+ tag: "component",
265
+ staticClass: "w-4 h-4",
266
+ class: [item.disabled ? "fill-color-icon-disabled" : ""]
267
+ }), item.text ? _c("span", [_vm._v(_vm._s(item.text))]) : _vm._e()], 1)]);
268
+ }), 1)];
269
+ },
270
+ proxy: true
271
+ }], null, false, 3388098432)
272
+ }, [_c(_vm.iconMore, {
273
+ tag: "component",
274
+ staticClass: "w-4 h-4"
275
+ }), _vm.state.effectOptions[0].text ? _c("span", {
276
+ staticClass: "ml-1 text-color-text-primary"
277
+ }, [_vm._v(_vm._s(_vm.t("ui.base.more")))]) : _vm._e()], 1) : _vm._e()], 2) : _vm._e()]) : _vm._e()]);
278
+ };
279
+ var staticRenderFns = [];
280
+ var __cssModules = {};
281
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
282
+ function __vue2_injectStyles(context) {
283
+ for (var o in __cssModules) {
284
+ this[o] = __cssModules[o];
285
+ }
286
+ }
287
+ var mobileFirst = /* @__PURE__ */ function() {
288
+ return __component__.exports;
289
+ }();
290
+
291
+ export { mobileFirst as default };
package/lib/pc.js ADDED
@@ -0,0 +1,266 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/card/vue';
2
+ import { defineComponent, $prefix, props, setup } from '@opentinyvue/vue-common';
3
+ import Dropdown from '@opentinyvue/vue-dropdown';
4
+ import DropdownMenu from '@opentinyvue/vue-dropdown-menu';
5
+ import DropdownItem from '@opentinyvue/vue-dropdown-item';
6
+ import Checkbox from '@opentinyvue/vue-checkbox';
7
+ import Radio from '@opentinyvue/vue-radio';
8
+ import '@opentinyvue/vue-theme/card/index.css';
9
+
10
+ var classes = {
11
+ "card": "overflow-hidden bg-color-bg-1 border hover:shadow",
12
+ "size-large": "rounded-lg min-w-[theme(spacing.112)]",
13
+ "size-medium": "rounded-lg min-w-[theme(spacing.72)]",
14
+ "size-small": "rounded-lg min-w-[theme(spacing.54)]",
15
+ "size-mini": "rounded min-w-[theme(spacing.32)]",
16
+ "size-large-padding": "p-4",
17
+ "size-medium-padding": "p-3",
18
+ "size-small-padding": "p-3",
19
+ "size-mini-padding": "p-2",
20
+ "size-large-width": "w-144",
21
+ "size-medium-width": "w-96",
22
+ "size-small-width": "w-72",
23
+ "size-mini-width": "w-44",
24
+ "status-success": "border-color-success",
25
+ "status-warning": "border-color-warning",
26
+ "status-alerting": "border-color-alert",
27
+ "status-danger": "border-color-error",
28
+ "status-default": "border-color-border-separator",
29
+ "title": "text-base sm:text-sm mb-3 leading-5.5 text-color-text-primary mr-2",
30
+ "checkbox": "relative left-1 pt-3 sm:pt-3.5 pl-2 [&_[data-tag=tiny-checkbox]]:p-0 [&_[data-tag=tiny-checkbox]>span>span]:p-0 [&_[data-tag=tiny-checkbox]>span:nth-child(2)]:hidden",
31
+ "radio": "relative left-0 sm:left-3 pt-0 sm:pt-3 [&_[role=radio]_span_span]:pr-0",
32
+ "logo": "flex mb-3 py-2 w-full justify-center items-center aspect-[5_/_2] overflow-hidden",
33
+ "main": "text-sm sm:text-xs text-color-text-secondary overflow-y-auto",
34
+ "footer": "p-3 border-t border-t-color-border-separator",
35
+ "options": "w-full px-3 h-11 flex items-center justify-around text-color-text-primary border-t border-t-color-border-separator"
36
+ };
37
+
38
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
39
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
40
+ if (render) {
41
+ options.render = render;
42
+ options.staticRenderFns = staticRenderFns;
43
+ options._compiled = true;
44
+ }
45
+ var hook;
46
+ if (injectStyles) {
47
+ hook = injectStyles;
48
+ }
49
+ if (hook) {
50
+ if (options.functional) {
51
+ options._injectStyles = hook;
52
+ var originalRender = options.render;
53
+ options.render = function renderWithStyleInjection(h, context) {
54
+ hook.call(context);
55
+ return originalRender(h, context);
56
+ };
57
+ } else {
58
+ var existing = options.beforeCreate;
59
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
60
+ }
61
+ }
62
+ return {
63
+ exports: scriptExports,
64
+ options
65
+ };
66
+ }
67
+
68
+ var __vue2_script = defineComponent({
69
+ name: $prefix + "Card",
70
+ emits: ["icon-click", "update:modelValue", "change", "click"],
71
+ components: {
72
+ TinyDropdown: Dropdown,
73
+ TinyDropdownMenu: DropdownMenu,
74
+ TinyDropdownItem: DropdownItem,
75
+ TinyCheckbox: Checkbox,
76
+ TinyRadio: Radio
77
+ },
78
+ props: [].concat(props, ["_constants", "modelValue", "src", "title", "customClass", "height", "label", "autoWidth", "options", "iconMore", "size", "status", "checkType", "type", "disabled", "checkMode"]),
79
+ setup: function setup$1(props2, context) {
80
+ return setup({
81
+ props: props2,
82
+ context,
83
+ renderless,
84
+ api,
85
+ classes
86
+ });
87
+ }
88
+ });
89
+ var render = function render2() {
90
+ var _vm = this;
91
+ var _h = _vm.$createElement;
92
+ var _c = _vm._self._c || _h;
93
+ return _c("div", {
94
+ staticClass: "tiny-card",
95
+ class: ["tiny-card--" + _vm.state.size, "tiny-card--" + _vm.state.status, _vm.state.autoWidth ? "" : "tiny-card--" + _vm.state.size + "-width", _vm.state.itemChecked ? _vm.state.checkMode === "badge" ? "tiny-card--item-checkbox-checked" : "tiny-card--item-checked" : "", _vm.state.disabled ? "tiny-card--disabled" : "", _vm.state.customClass],
96
+ on: {
97
+ "click": function click($event) {
98
+ return _vm.cardClick($event);
99
+ }
100
+ }
101
+ }, [_c("div", {
102
+ staticClass: "tiny-card__body",
103
+ style: {
104
+ "display": _vm.state.type === "text" ? "flex" : "block"
105
+ }
106
+ }, [_vm.state.checkType === "checkbox" && _vm.state.type === "text" && _vm.state.checkMode === "normal" ? _c("div", {
107
+ staticClass: "tiny-card--checkbox"
108
+ }, [_c("tiny-checkbox", {
109
+ attrs: {
110
+ "label": _vm.label,
111
+ "text": "",
112
+ "disabled": _vm.state.disabled
113
+ },
114
+ on: {
115
+ "change": _vm.handleChange
116
+ },
117
+ model: {
118
+ value: _vm.state.model,
119
+ callback: function callback($$v) {
120
+ _vm.$set(_vm.state, "model", $$v);
121
+ },
122
+ expression: "state.model"
123
+ }
124
+ })], 1) : _vm._e(), _vm.state.checkType === "radio" && _vm.state.type === "text" && _vm.state.checkMode === "normal" ? _c("div", {
125
+ staticClass: "tiny-card--radio"
126
+ }, [_c("tiny-radio", {
127
+ attrs: {
128
+ "label": _vm.label,
129
+ "disabled": _vm.state.disabled
130
+ },
131
+ on: {
132
+ "change": _vm.handleChange
133
+ },
134
+ model: {
135
+ value: _vm.state.model,
136
+ callback: function callback($$v) {
137
+ _vm.$set(_vm.state, "model", $$v);
138
+ },
139
+ expression: "state.model"
140
+ }
141
+ }, [_c("span")])], 1) : _vm._e(), _vm.state.type === "image" ? _c("div", {
142
+ staticClass: "tiny-card--image"
143
+ }, [_c("img", {
144
+ attrs: {
145
+ "src": _vm.src
146
+ }
147
+ })]) : _vm._e(), _vm.state.type === "video" ? _c("div", {
148
+ staticClass: "tiny-card--video"
149
+ }, [_c("video", {
150
+ attrs: {
151
+ "src": _vm.src,
152
+ "controls": ""
153
+ }
154
+ })]) : _vm._e(), _c("div", {
155
+ staticClass: "tiny-card--logo",
156
+ class: "tiny-card--" + _vm.state.size + "-padding"
157
+ }, [_vm.state.type === "logo" ? _c("div", {
158
+ staticClass: "tiny-card--logo__head"
159
+ }, [_c("img", {
160
+ attrs: {
161
+ "src": _vm.src
162
+ }
163
+ })]) : _vm._e(), _vm.title || _vm.slots.title ? _c("div", {
164
+ staticClass: "tiny-card--logo__title",
165
+ class: _vm.state.type === "logo" ? "tiny-card--logo__title--type-logo" : ""
166
+ }, [_vm._t("title-left"), _vm._t("title", function() {
167
+ return [_c("p", {
168
+ staticClass: "tiny-card--logo__title--p"
169
+ }, [_vm._v(_vm._s(_vm.title))])];
170
+ }), _vm._t("title-right")], 2) : _vm._e(), _c("div", {
171
+ staticClass: "tiny-card--logo__main",
172
+ class: _vm.state.type === "logo" ? "tiny-card--logo__main-type-logo" : "",
173
+ style: {
174
+ height: _vm.state.height
175
+ }
176
+ }, [_vm._t("default")], 2)])]), _vm.state.effectOptions.length || _vm.slots.footer ? _c("div", {
177
+ staticClass: "tiny-card__footer"
178
+ }, [_vm.slots.footer ? _c("div", {
179
+ staticClass: "tiny-card__footer-footer"
180
+ }, [_vm._t("footer")], 2) : _vm._e(), _vm.state.effectOptions.length ? _c("div", {
181
+ staticClass: "tiny-card__footer-options"
182
+ }, [_vm._l(_vm.state.effectOptions.slice(0, _vm.state.sliceNum), function(item, index) {
183
+ return _c("div", {
184
+ key: item.text + index,
185
+ staticClass: "tiny-card__footer-options-div",
186
+ class: item.disabled ? "tiny-card__footer-options-disabled" : "",
187
+ on: {
188
+ "click": function click($event) {
189
+ $event.stopPropagation();
190
+ return _vm.handelIconClick(item, index, $event);
191
+ }
192
+ }
193
+ }, [_c(item.icon, {
194
+ tag: "component",
195
+ staticClass: "tiny-card__footer-options-icon",
196
+ class: item.disabled ? "tiny-card__footer-options-icon-disabled" : ""
197
+ }), item.text ? _c("span", {
198
+ staticClass: "tiny-card__footer-options-span"
199
+ }, [_vm._v(_vm._s(item.text))]) : _vm._e()], 1);
200
+ }), _vm.state.effectOptions.length === _vm.state.iconNum ? _c("div", {
201
+ staticClass: "tiny-card__footer-options-div",
202
+ class: _vm.state.effectOptions[_vm.state.sliceNum].disabled ? "tiny-card__footer-options-disabled" : "",
203
+ on: {
204
+ "click": function click($event) {
205
+ $event.stopPropagation();
206
+ return _vm.handelIconClick(_vm.state.effectOptions[_vm.state.sliceNum], _vm.state.sliceNum, $event);
207
+ }
208
+ }
209
+ }, [_c(_vm.state.effectOptions[_vm.state.sliceNum].icon, {
210
+ tag: "component",
211
+ staticClass: "tiny-card__footer-options-icon",
212
+ class: _vm.state.effectOptions[_vm.state.sliceNum].disabled ? "tiny-card__footer-options-icon-disabled" : ""
213
+ }), _vm.state.effectOptions[_vm.state.sliceNum].text ? _c("span", {
214
+ staticClass: "tiny-card__footer-options-span"
215
+ }, [_vm._v(_vm._s(_vm.state.effectOptions[_vm.state.sliceNum].text))]) : _vm._e()], 1) : _vm._e(), _vm.state.effectOptions.length > _vm.state.iconNum ? _c("tiny-dropdown", {
216
+ staticClass: "tiny-card__footer-options-dropdown",
217
+ attrs: {
218
+ "show-self-icon": ""
219
+ },
220
+ scopedSlots: _vm._u([{
221
+ key: "dropdown",
222
+ fn: function fn() {
223
+ return [_c("tiny-dropdown-menu", {
224
+ attrs: {
225
+ "placement": "bottom"
226
+ }
227
+ }, _vm._l(_vm.state.effectOptions.slice(_vm.state.sliceNum), function(item, index) {
228
+ return _c("tiny-dropdown-item", {
229
+ key: item.text + index
230
+ }, [_c("div", {
231
+ class: ["tiny-card__footer-dropdown-item", item.disabled ? "tiny-card__footer-dropdown-item-disabled" : ""],
232
+ on: {
233
+ "click": function click($event) {
234
+ $event.stopPropagation();
235
+ return _vm.handelIconClick(item, index + _vm.state.sliceNum, $event);
236
+ }
237
+ }
238
+ }, [_c(item.icon, {
239
+ tag: "component",
240
+ staticClass: "tiny-card__footer-options-icon",
241
+ class: item.disabled ? "tiny-card__footer-options-icon-disabled" : ""
242
+ }), item.text ? _c("span", [_vm._v(_vm._s(item.text))]) : _vm._e()], 1)]);
243
+ }), 1)];
244
+ },
245
+ proxy: true
246
+ }], null, false, 1685382823)
247
+ }, [_c(_vm.iconMore, {
248
+ tag: "component",
249
+ staticClass: "tiny-card__footer-options-icon"
250
+ }), _vm.state.effectOptions[0].text ? _c("span", {
251
+ staticClass: "tiny-card__footer-more"
252
+ }, [_vm._v(_vm._s(_vm.t("ui.base.more")))]) : _vm._e()], 1) : _vm._e()], 2) : _vm._e()]) : _vm._e()]);
253
+ };
254
+ var staticRenderFns = [];
255
+ var __cssModules = {};
256
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
257
+ function __vue2_injectStyles(context) {
258
+ for (var o in __cssModules) {
259
+ this[o] = __cssModules[o];
260
+ }
261
+ }
262
+ var pc = /* @__PURE__ */ function() {
263
+ return __component__.exports;
264
+ }();
265
+
266
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@opentinyvue/vue-card",
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-renderless": "~3.21.0",
11
+ "@opentinyvue/vue-common": "~2.21.0",
12
+ "@opentinyvue/vue-dropdown": "~2.21.0",
13
+ "@opentinyvue/vue-dropdown-menu": "~2.21.0",
14
+ "@opentinyvue/vue-dropdown-item": "~2.21.0",
15
+ "@opentinyvue/vue-icon": "~2.21.0",
16
+ "@opentinyvue/vue-radio": "~2.21.0",
17
+ "@opentinyvue/vue-checkbox": "~2.21.0",
18
+ "@opentinyvue/vue-theme": "~3.21.0"
19
+ },
20
+ "license": "MIT",
21
+ "types": "index.d.ts"
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ export declare const cardProps: {
2
+ _constants: {
3
+ type: ObjectConstructor;
4
+ default: () => {
5
+ CARD_GROUP: string;
6
+ };
7
+ };
8
+ modelValue: {};
9
+ src: StringConstructor;
10
+ title: StringConstructor;
11
+ customClass: StringConstructor;
12
+ height: StringConstructor;
13
+ label: {};
14
+ autoWidth: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ options: {
19
+ type: ArrayConstructor;
20
+ default: () => never[];
21
+ };
22
+ iconMore: {
23
+ type: (StringConstructor | ObjectConstructor)[];
24
+ default: () => any;
25
+ };
26
+ size: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ status: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ checkType: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ type: {
39
+ type: StringConstructor;
40
+ default: string;
41
+ };
42
+ disabled: {
43
+ type: BooleanConstructor;
44
+ default: boolean;
45
+ };
46
+ checkMode: {
47
+ type: StringConstructor;
48
+ default: string;
49
+ };
50
+ tiny_mode: StringConstructor;
51
+ tiny_mode_root: BooleanConstructor;
52
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
53
+ tiny_renderless: FunctionConstructor;
54
+ tiny_theme: StringConstructor;
55
+ tiny_chart_theme: ObjectConstructor;
56
+ };
57
+ declare const _default: any;
58
+ 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;
package/src/token.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ export declare const classes: {
2
+ card: string;
3
+ 'size-large': string;
4
+ 'size-medium': string;
5
+ 'size-small': string;
6
+ 'size-mini': string;
7
+ 'size-large-padding': string;
8
+ 'size-medium-padding': string;
9
+ 'size-small-padding': string;
10
+ 'size-mini-padding': string;
11
+ 'size-large-width': string;
12
+ 'size-medium-width': string;
13
+ 'size-small-width': string;
14
+ 'size-mini-width': string;
15
+ 'status-success': string;
16
+ 'status-warning': string;
17
+ 'status-alerting': string;
18
+ 'status-danger': string;
19
+ 'status-default': string;
20
+ title: string;
21
+ checkbox: string;
22
+ radio: string;
23
+ logo: string;
24
+ main: string;
25
+ footer: string;
26
+ options: string;
27
+ };