@opentinyvue/vue-column-list-item 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 ColumnListItem from './src/mobile-first.vue';
2
+ export default ColumnListItem;
package/lib/index.js ADDED
@@ -0,0 +1,378 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/column-list-item/vue';
2
+ import { defineComponent, $prefix, setup, $props } 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
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
11
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
12
+ if (render) {
13
+ options.render = render;
14
+ options.staticRenderFns = staticRenderFns;
15
+ options._compiled = true;
16
+ }
17
+ var hook;
18
+ if (injectStyles) {
19
+ hook = injectStyles;
20
+ }
21
+ if (hook) {
22
+ if (options.functional) {
23
+ options._injectStyles = hook;
24
+ var originalRender = options.render;
25
+ options.render = function renderWithStyleInjection(h, context) {
26
+ hook.call(context);
27
+ return originalRender(h, context);
28
+ };
29
+ } else {
30
+ var existing = options.beforeCreate;
31
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
32
+ }
33
+ }
34
+ return {
35
+ exports: scriptExports,
36
+ options
37
+ };
38
+ }
39
+
40
+ function _extends() {
41
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
42
+ for (var e = 1; e < arguments.length; e++) {
43
+ var t = arguments[e];
44
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
45
+ }
46
+ return n;
47
+ }, _extends.apply(null, arguments);
48
+ }
49
+ var render = function render2() {
50
+ var _vm = this;
51
+ var _h = _vm.$createElement;
52
+ var _c = _vm._self._c || _h;
53
+ return _c("div", {
54
+ staticClass: "block sm:flex bg-color-bg-1 w-full py-2.5 px-3 sm:pb-2.5 text-sm sm:text-xs border-color-border-separator",
55
+ class: _vm.m(_vm.state.effectOptions.length ? "pb-0" : "pb-3", _vm.image && !_vm.state.showCheckbox && !_vm.state.showRadio ? "pl-4" : "pl-3", _vm.state.type === "list" ? "pl-0 pr-0 border-b-0.5 sm:border-b-px [&:last-child]:border-none" : "border-0.5 sm:border rounded-lg sm:rounded hover:shadow", _vm.customClass),
56
+ attrs: {
57
+ "data-tag": "tiny-column-list-item",
58
+ "role": "column-list-item"
59
+ },
60
+ on: {
61
+ "click": function click($event) {
62
+ return _vm.$emit("click", $event);
63
+ }
64
+ }
65
+ }, [_vm.state.showCheckbox ? _c("div", {
66
+ staticClass: "float-left sm:float-none mr-3 [&_[data-tag=tiny-checkbox]]:p-0 [&_[data-tag=tiny-checkbox]>span>span]:p-0 [&_[data-tag=tiny-checkbox]>span:nth-child(2)]:hidden",
67
+ attrs: {
68
+ "data-tag": "tiny-column-list-item-checkbox"
69
+ }
70
+ }, [_c("tiny-checkbox", {
71
+ attrs: {
72
+ "disabled": _vm.state.disabled,
73
+ "label": _vm.label
74
+ },
75
+ on: {
76
+ "change": _vm.handleChange
77
+ },
78
+ model: {
79
+ value: _vm.state.model,
80
+ callback: function callback($$v) {
81
+ _vm.$set(_vm.state, "model", $$v);
82
+ },
83
+ expression: "state.model"
84
+ }
85
+ })], 1) : _vm._e(), _vm.state.showRadio ? _c("div", {
86
+ staticClass: "float-left sm:float-none mr-1.5 sm:mr-0 [&_[role=radio]]:w-6 [&_[role=radio]]:h-5 [&_[role=radio]_span_span]:p-0",
87
+ attrs: {
88
+ "data-tag": "tiny-column-list-item-radio"
89
+ }
90
+ }, [_c("tiny-radio", {
91
+ attrs: {
92
+ "disabled": _vm.state.disabled,
93
+ "label": _vm.label
94
+ },
95
+ on: {
96
+ "change": _vm.handleChange
97
+ },
98
+ model: {
99
+ value: _vm.state.model,
100
+ callback: function callback($$v) {
101
+ _vm.$set(_vm.state, "model", $$v);
102
+ },
103
+ expression: "state.model"
104
+ }
105
+ }, [_c("span")])], 1) : _vm._e(), _vm.image || _vm.slots.image && _vm.slots.image() ? _c("div", {
106
+ staticClass: "float-left block sm:flex mr-3 shrink-0 pt-1",
107
+ class: [_vm.state.size === "small" ? "w-9 h-11" : "w-14 sm:w-11 h-16"],
108
+ attrs: {
109
+ "data-tag": "tiny-column-list-item-image"
110
+ }
111
+ }, [_vm._t("image", function() {
112
+ return [typeof _vm.image === "string" ? _c("img", {
113
+ staticClass: "rounded",
114
+ class: [_vm.state.size === "small" ? "w-9 h-9" : "w-14 sm:w-11 h-14 sm:h-11"],
115
+ attrs: {
116
+ "src": _vm.image
117
+ }
118
+ }) : _c(_vm.image, {
119
+ tag: "component",
120
+ staticClass: "rounded",
121
+ class: [_vm.state.size === "small" ? "w-9 h-9" : "w-14 sm:w-11 h-14 sm:h-11"]
122
+ })];
123
+ })], 2) : _vm._e(), _c("div", {
124
+ staticClass: "block text-left sm:flex flex-auto flex-wrap",
125
+ attrs: {
126
+ "data-tag": "tiny-column-list-item-column1"
127
+ }
128
+ }, [_vm.slots.column1 && _vm.slots.column1() ? _c("div", {
129
+ staticClass: "min-w-[theme(spacing.40)] overflow-hidden sm:ml-0 pr-0 sm:pr-5",
130
+ style: {
131
+ "flex-grow": _vm.flexGrow[0] || 0,
132
+ "flex-basis": _vm.flexBasis[0] || "auto"
133
+ }
134
+ }, [_vm._t("column1")], 2) : _vm._e(), _vm.slots.column2 && _vm.slots.column2() ? _c("div", {
135
+ staticClass: "min-w-[theme(spacing.40)] overflow-hidden pr-0 sm:pr-5 mt-1 sm:mt-0 pt-0 sm:pt-1",
136
+ class: [_vm.state.showCheckbox || _vm.state.showRadio ? "pl-8 sm:pl-0" : ""],
137
+ style: {
138
+ "flex-grow": _vm.flexGrow[1] || 0,
139
+ "flex-basis": _vm.flexBasis[1] || "auto"
140
+ },
141
+ attrs: {
142
+ "data-tag": "tiny-column-list-item-column2"
143
+ }
144
+ }, [_vm._t("column2")], 2) : _vm._e(), _vm.slots.column3 && _vm.slots.column3() ? _c("div", {
145
+ staticClass: "min-w-[theme(spacing.40)] overflow-hidden pr-0 sm:pr-5 mt-1 sm:mt-0 pt-0 sm:pt-1",
146
+ class: [_vm.state.showCheckbox || _vm.state.showRadio ? "pl-8 sm:pl-0" : ""],
147
+ style: {
148
+ "flex-grow": _vm.flexGrow[2] || 0,
149
+ "flex-basis": _vm.flexBasis[2] || "auto"
150
+ },
151
+ attrs: {
152
+ "data-tag": "tiny-column-list-item-column3"
153
+ }
154
+ }, [_vm._t("column3")], 2) : _vm._e(), _vm.slots.column4 && _vm.slots.column4() ? _c("div", {
155
+ staticClass: "min-w-[theme(spacing.40)] overflow-hidden pr-0 sm:pr-5 mt-1 sm:mt-0 pt-0 sm:pt-1",
156
+ class: [_vm.state.showCheckbox || _vm.state.showRadio ? "pl-8 sm:pl-0" : ""],
157
+ style: {
158
+ "flex-grow": _vm.flexGrow[3] || 0,
159
+ "flex-basis": _vm.flexBasis[3] || "auto"
160
+ },
161
+ attrs: {
162
+ "data-tag": "tiny-column-list-item-column4"
163
+ }
164
+ }, [_vm._t("column4")], 2) : _vm._e()]), _vm.state.effectOptions.length || _vm.slots.operate && _vm.slots.operate() ? _c("hr", {
165
+ staticClass: "block sm:hidden mt-2.5 -mx-3 border-t-0.5 border-t-color-border-separator"
166
+ }) : _vm._e(), _vm.state.effectOptions.length || _vm.slots.operate && _vm.slots.operate() ? _c("div", {
167
+ staticClass: "w-full sm:w-auto px-0 sm:pl-5 sm:pr-1 h-12 sm:h-auto flex flex-row sm:flex-col items-center justify-around sm:justify-center sm:items-start shadow-none sm:shadow-[-6px_0px_5px_-5px_#e8ebef] shrink-0 text-color-text-primary",
168
+ style: {
169
+ flexBasis: _vm.operateFlexBasis
170
+ },
171
+ attrs: {
172
+ "data-tag": "tiny-column-list-item-operatebox"
173
+ }
174
+ }, [_vm._t("operate", function() {
175
+ return [_vm._l(_vm.state.effectOptions.slice(0, _vm.state.sliceNum), function(item, index) {
176
+ return _c("div", {
177
+ key: item.text + index,
178
+ staticClass: "cursor-pointer mb-0 sm:mb-2 line-clamp-1",
179
+ class: [item.disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
180
+ attrs: {
181
+ "data-tag": "tiny-column-list-item-operate"
182
+ },
183
+ on: {
184
+ "click": function click($event) {
185
+ $event.stopPropagation();
186
+ return _vm.handelIconClick(item, index, $event);
187
+ }
188
+ }
189
+ }, [_c(item.icon, {
190
+ tag: "component",
191
+ staticClass: "w-4 h-4",
192
+ class: [item.disabled ? "fill-color-icon-disabled" : ""]
193
+ }), item.text ? _c("span", {
194
+ staticClass: "ml-1 align-middle"
195
+ }, [_vm._v(_vm._s(item.text))]) : _vm._e()], 1);
196
+ }), _vm.state.effectOptions.length === _vm.state.iconNum ? _c("div", {
197
+ staticClass: "cursor-pointer",
198
+ class: [_vm.state.effectOptions[_vm.state.sliceNum].disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
199
+ attrs: {
200
+ "data-tag": "tiny-column-list-item-iconnum"
201
+ },
202
+ on: {
203
+ "click": function click($event) {
204
+ $event.stopPropagation();
205
+ return _vm.handelIconClick(_vm.state.effectOptions[_vm.state.sliceNum], _vm.state.sliceNum, $event);
206
+ }
207
+ }
208
+ }, [_c(_vm.state.effectOptions[_vm.state.sliceNum].icon, {
209
+ tag: "component",
210
+ staticClass: "w-4 h-4",
211
+ class: [_vm.state.effectOptions[_vm.state.sliceNum].disabled ? "fill-color-icon-disabled" : ""]
212
+ }), _vm.state.effectOptions[_vm.state.sliceNum].text ? _c("span", {
213
+ staticClass: "ml-1 align-middle"
214
+ }, [_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", {
215
+ attrs: {
216
+ "show-self-icon": ""
217
+ },
218
+ nativeOn: {
219
+ "click": function click($event) {
220
+ $event.stopPropagation();
221
+ }
222
+ },
223
+ scopedSlots: _vm._u([{
224
+ key: "dropdown",
225
+ fn: function fn() {
226
+ return [_c("tiny-dropdown-menu", {
227
+ attrs: {
228
+ "placement": "bottom"
229
+ }
230
+ }, _vm._l(_vm.state.effectOptions.slice(_vm.state.sliceNum), function(item, index) {
231
+ return _c("tiny-dropdown-item", {
232
+ key: item.text + index
233
+ }, [_c("div", {
234
+ class: ["px-2", item.disabled ? "text-color-text-disabled cursor-not-allowed" : ""],
235
+ on: {
236
+ "click": function click($event) {
237
+ $event.stopPropagation();
238
+ return _vm.handelIconClick(item, index + _vm.state.sliceNum, $event);
239
+ }
240
+ }
241
+ }, [_c(item.icon, {
242
+ tag: "component",
243
+ staticClass: "w-4 h-4",
244
+ class: [item.disabled ? "fill-color-icon-disabled" : ""]
245
+ }), item.text ? _c("span", [_vm._v(_vm._s(item.text))]) : _vm._e()], 1)]);
246
+ }), 1)];
247
+ },
248
+ proxy: true
249
+ }], null, false, 3388098432)
250
+ }, [_c(_vm.iconMore, {
251
+ tag: "component",
252
+ staticClass: "w-4 h-4"
253
+ }), _vm.state.effectOptions[0].text ? _c("span", {
254
+ staticClass: "ml-1 text-color-text-primary"
255
+ }, [_vm._v(_vm._s(_vm.t("ui.base.more")))]) : _vm._e()], 1) : _vm._e()];
256
+ })], 2) : _vm._e()]);
257
+ };
258
+ var staticRenderFns = [];
259
+ var $constants = {
260
+ COLUMN_GROUP: "ColumnListGroup"
261
+ };
262
+ var __vue2_script = defineComponent({
263
+ name: $prefix + "ColumnListItem",
264
+ emits: ["icon-click", "update:modelValue", "change", "click"],
265
+ components: {
266
+ TinyDropdown: Dropdown,
267
+ TinyDropdownMenu: DropdownMenu,
268
+ TinyDropdownItem: DropdownItem,
269
+ TinyCheckbox: Checkbox,
270
+ TinyRadio: Radio,
271
+ IconEllipsis: IconEllipsis()
272
+ },
273
+ props: _extends({}, $props, {
274
+ _constants: {
275
+ type: Object,
276
+ default: function _default() {
277
+ return $constants;
278
+ }
279
+ },
280
+ modelValue: {},
281
+ label: {},
282
+ data: {
283
+ type: Object,
284
+ default: function _default2() {
285
+ return {};
286
+ }
287
+ },
288
+ options: {
289
+ type: Array,
290
+ default: function _default3() {
291
+ return [];
292
+ }
293
+ },
294
+ flexGrow: {
295
+ type: Array,
296
+ default: function _default4() {
297
+ return [1, 1, 1, 1];
298
+ },
299
+ validator: function validator(value) {
300
+ return value.every(function(val) {
301
+ return typeof val === "number" && val >= 0;
302
+ });
303
+ }
304
+ },
305
+ flexBasis: {
306
+ type: Array,
307
+ default: function _default5() {
308
+ return [];
309
+ }
310
+ },
311
+ image: {
312
+ type: String,
313
+ default: ""
314
+ },
315
+ iconMore: {
316
+ type: [Object, String],
317
+ default: function _default6() {
318
+ return IconEllipsis();
319
+ }
320
+ },
321
+ size: {
322
+ type: String,
323
+ default: "medium"
324
+ },
325
+ showCheckbox: {
326
+ type: Boolean,
327
+ default: false
328
+ },
329
+ showRadio: {
330
+ type: Boolean,
331
+ default: false
332
+ },
333
+ disabled: {
334
+ type: Boolean,
335
+ default: false
336
+ },
337
+ type: {
338
+ type: String,
339
+ default: ""
340
+ },
341
+ customClass: {
342
+ type: String,
343
+ default: ""
344
+ },
345
+ // Tiny新增用于自定义操作列宽度
346
+ operateFlexBasis: String
347
+ }),
348
+ setup: function setup$1(props, context) {
349
+ return setup({
350
+ props,
351
+ context,
352
+ renderless,
353
+ api,
354
+ mono: true
355
+ });
356
+ }
357
+ });
358
+ var __cssModules = {};
359
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
360
+ function __vue2_injectStyles(context) {
361
+ for (var o in __cssModules) {
362
+ this[o] = __cssModules[o];
363
+ }
364
+ }
365
+ var ColumnListItem = /* @__PURE__ */ function() {
366
+ return __component__.exports;
367
+ }();
368
+ var version = "2.21.0";
369
+ ColumnListItem.model = {
370
+ prop: "modelValue",
371
+ event: "update:modelValue"
372
+ };
373
+ ColumnListItem.install = function(Vue) {
374
+ Vue.component(ColumnListItem.name, ColumnListItem);
375
+ };
376
+ ColumnListItem.version = version;
377
+
378
+ export { ColumnListItem as default };
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@opentinyvue/vue-column-list-item",
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-checkbox": "~2.21.0",
11
+ "@opentinyvue/vue-common": "~2.21.0",
12
+ "@opentinyvue/vue-dropdown": "~2.21.0",
13
+ "@opentinyvue/vue-dropdown-item": "~2.21.0",
14
+ "@opentinyvue/vue-dropdown-menu": "~2.21.0",
15
+ "@opentinyvue/vue-icon": "~2.21.0",
16
+ "@opentinyvue/vue-renderless": "~3.21.0",
17
+ "@opentinyvue/vue-radio": "~2.21.0"
18
+ },
19
+ "license": "MIT",
20
+ "types": "index.d.ts"
21
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;