@opentiny/vue-dynamic-scroller 2.8.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 DynamicScroller from './src/index';
2
+ export default DynamicScroller;
package/lib/index.js ADDED
@@ -0,0 +1,72 @@
1
+ function _extends() {
2
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
3
+ for (var i = 1; i < arguments.length; i++) {
4
+ var source = arguments[i];
5
+ for (var key in source) {
6
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ }
11
+ return target;
12
+ };
13
+ return _extends.apply(this, arguments);
14
+ }
15
+ import { defineComponent, $prefix, $props, $setup } from "@opentiny/vue-common";
16
+ import PcTemplate from "./pc.js";
17
+ import RecycleScroller from "@opentiny/vue-recycle-scroller";
18
+ var template = function template2(mode) {
19
+ if ("mobile" === (process.env.TINY_MODE || mode))
20
+ return MobileTemplate;
21
+ else if ("mobile-first" === (process.env.TINY_MODE || mode))
22
+ return MobileFirstTemplate;
23
+ else
24
+ return PcTemplate;
25
+ };
26
+ var DynamicScroller = defineComponent({
27
+ name: $prefix + "DynamicScroller",
28
+ props: _extends({}, $props, {
29
+ items: {
30
+ type: Array,
31
+ required: true
32
+ },
33
+ keyField: {
34
+ type: String,
35
+ default: "id"
36
+ },
37
+ direction: {
38
+ type: String,
39
+ default: "vertical",
40
+ validator: function validator(value) {
41
+ return ["vertical", "horizontal"].includes(value);
42
+ }
43
+ },
44
+ listTag: {
45
+ type: String,
46
+ default: "div"
47
+ },
48
+ itemTag: {
49
+ type: String,
50
+ default: "div"
51
+ },
52
+ minItemSize: {
53
+ type: [Number, String],
54
+ required: true
55
+ }
56
+ }),
57
+ setup: function setup(props, context) {
58
+ return $setup({
59
+ props,
60
+ context,
61
+ template
62
+ });
63
+ }
64
+ });
65
+ DynamicScroller.IdState = RecycleScroller.IdState;
66
+ DynamicScroller.install = function(Vue) {
67
+ Vue.component(DynamicScroller.name, DynamicScroller);
68
+ };
69
+ DynamicScroller.version = process.env.COMPONENT_VERSION;
70
+ export {
71
+ DynamicScroller as default
72
+ };
package/lib/pc.js ADDED
@@ -0,0 +1,141 @@
1
+ import { renderless, api } from "@opentiny/vue-renderless/dynamic-scroller/vue";
2
+ import { defineComponent, props, setup as _setup, emitter } from "@opentiny/vue-common";
3
+ import RecycleScroller from "@opentiny/vue-recycle-scroller";
4
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
5
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
6
+ if (render) {
7
+ options.render = render;
8
+ options.staticRenderFns = staticRenderFns;
9
+ options._compiled = true;
10
+ }
11
+ if (functionalTemplate) {
12
+ options.functional = true;
13
+ }
14
+ if (scopeId) {
15
+ options._scopeId = "data-v-" + scopeId;
16
+ }
17
+ var hook;
18
+ if (moduleIdentifier) {
19
+ hook = function hook2(context) {
20
+ context = context || // cached call
21
+ this.$vnode && this.$vnode.ssrContext || // stateful
22
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
23
+ if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
24
+ context = __VUE_SSR_CONTEXT__;
25
+ }
26
+ if (injectStyles) {
27
+ injectStyles.call(this, context);
28
+ }
29
+ if (context && context._registeredComponents) {
30
+ context._registeredComponents.add(moduleIdentifier);
31
+ }
32
+ };
33
+ options._ssrRegister = hook;
34
+ } else if (injectStyles) {
35
+ hook = shadowMode ? function() {
36
+ injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
37
+ } : injectStyles;
38
+ }
39
+ if (hook) {
40
+ if (options.functional) {
41
+ options._injectStyles = hook;
42
+ var originalRender = options.render;
43
+ options.render = function renderWithStyleInjection(h, context) {
44
+ hook.call(context);
45
+ return originalRender(h, context);
46
+ };
47
+ } else {
48
+ var existing = options.beforeCreate;
49
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
50
+ }
51
+ }
52
+ return {
53
+ exports: scriptExports,
54
+ options
55
+ };
56
+ }
57
+
58
+ var __vue2_script = defineComponent({
59
+ inheritAttrs: false,
60
+ emits: ["resize", "visible"],
61
+ props: [].concat(props, ["items", "keyField", "direction", "listTag", "itemTag", "minItemSize"]),
62
+ components: {
63
+ TinyRecycleScroller: RecycleScroller
64
+ },
65
+ setup: function setup(props2, context) {
66
+ return _setup({
67
+ props: props2,
68
+ context,
69
+ renderless,
70
+ api,
71
+ extendOptions: {
72
+ emitter
73
+ }
74
+ });
75
+ }
76
+ });
77
+ var render = function render2() {
78
+ var _vm = this;
79
+ var _h = _vm.$createElement;
80
+ var _c = _vm._self._c || _h;
81
+ return _c("tiny-recycle-scroller", _vm._b({
82
+ ref: "scroller",
83
+ staticClass: "tiny-dynamic-scroller",
84
+ attrs: {
85
+ "items": _vm.state.itemsWithSize,
86
+ "min-item-size": _vm.minItemSize,
87
+ "direction": _vm.direction,
88
+ "key-field": _vm.keyField,
89
+ "list-tag": _vm.listTag,
90
+ "item-tag": _vm.itemTag
91
+ },
92
+ on: {
93
+ "resize": _vm.onScrollerResize,
94
+ "visible": _vm.onScrollerVisible
95
+ },
96
+ scopedSlots: _vm._u([{
97
+ key: "default",
98
+ fn: function fn(_ref) {
99
+ var itemWithSize = _ref.item, index = _ref.index, active = _ref.active;
100
+ return [_vm._t("default", null, null, {
101
+ item: itemWithSize.item,
102
+ index,
103
+ active,
104
+ itemWithSize
105
+ })];
106
+ }
107
+ }, {
108
+ key: "before",
109
+ fn: function fn() {
110
+ return [_vm._t("before")];
111
+ },
112
+ proxy: true
113
+ }, {
114
+ key: "after",
115
+ fn: function fn() {
116
+ return [_vm._t("after")];
117
+ },
118
+ proxy: true
119
+ }, {
120
+ key: "empty",
121
+ fn: function fn() {
122
+ return [_vm._t("empty")];
123
+ },
124
+ proxy: true
125
+ }], null, true)
126
+ }, "tiny-recycle-scroller", _vm.$attrs, false));
127
+ };
128
+ var staticRenderFns = [];
129
+ var __cssModules = {};
130
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
131
+ function __vue2_injectStyles(context) {
132
+ for (var o in __cssModules) {
133
+ this[o] = __cssModules[o];
134
+ }
135
+ }
136
+ var pc = /* @__PURE__ */ function() {
137
+ return __component__.exports;
138
+ }();
139
+ export {
140
+ pc as default
141
+ };
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@opentiny/vue-dynamic-scroller",
3
+ "version": "2.8.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "dependencies": {
8
+ "@opentiny/vue-common": "~2.8.0",
9
+ "@opentiny/vue-renderless": "~3.8.0",
10
+ "@opentiny/vue-recycle-scroller": "~2.8.0"
11
+ },
12
+ "license": "MIT",
13
+ "types": "index.d.ts"
14
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,81 @@
1
+ declare const _default: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode> & import("@vue/composition-api").Data, {}, {}, {
2
+ items: {
3
+ type: ArrayConstructor;
4
+ required: true;
5
+ };
6
+ keyField: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ direction: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ validator: (value: unknown) => boolean;
14
+ };
15
+ listTag: {
16
+ type: StringConstructor;
17
+ default: string;
18
+ };
19
+ itemTag: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ minItemSize: {
24
+ type: (StringConstructor | NumberConstructor)[];
25
+ required: true;
26
+ };
27
+ tiny_mode: StringConstructor;
28
+ tiny_mode_root: BooleanConstructor;
29
+ tiny_template: (FunctionConstructor | ObjectConstructor)[];
30
+ tiny_renderless: FunctionConstructor;
31
+ tiny_theme: StringConstructor;
32
+ tiny_chart_theme: ObjectConstructor;
33
+ }, {
34
+ tiny_mode_root: boolean;
35
+ direction: string;
36
+ items: unknown[];
37
+ keyField: string;
38
+ listTag: string;
39
+ itemTag: string;
40
+ minItemSize: string | number;
41
+ } & {
42
+ tiny_mode?: string | undefined;
43
+ tiny_template?: unknown;
44
+ tiny_renderless?: Function | undefined;
45
+ tiny_theme?: string | undefined;
46
+ tiny_chart_theme?: Record<string, any> | undefined;
47
+ }> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
48
+ tiny_mode_root: boolean;
49
+ direction: string;
50
+ items: unknown[];
51
+ keyField: string;
52
+ listTag: string;
53
+ itemTag: string;
54
+ minItemSize: string | number;
55
+ } & {
56
+ tiny_mode?: string | undefined;
57
+ tiny_template?: unknown;
58
+ tiny_renderless?: Function | undefined;
59
+ tiny_theme?: string | undefined;
60
+ tiny_chart_theme?: Record<string, any> | undefined;
61
+ }, import("@vue/composition-api").ShallowUnwrapRef<() => import("vue").VNode>, import("@vue/composition-api").Data, {}, {}, {
62
+ tiny_mode_root: boolean;
63
+ direction: string;
64
+ items: unknown[];
65
+ keyField: string;
66
+ listTag: string;
67
+ itemTag: string;
68
+ minItemSize: string | number;
69
+ } & {
70
+ tiny_mode?: string | undefined;
71
+ tiny_template?: unknown;
72
+ tiny_renderless?: Function | undefined;
73
+ tiny_theme?: string | undefined;
74
+ tiny_chart_theme?: Record<string, any> | undefined;
75
+ }, {
76
+ direction: string;
77
+ keyField: string;
78
+ listTag: string;
79
+ itemTag: string;
80
+ }, true>);
81
+ export default _default;
@@ -0,0 +1,12 @@
1
+ declare const _sfc_main: import("vue").ComponentOptions<import("vue").default, import("@vue/composition-api").ShallowUnwrapRef<any> & import("@vue/composition-api").Data, {}, {}, Readonly<{
2
+ [x: string]: any;
3
+ }>, {
4
+ [x: string]: any;
5
+ } & {}> & import("vue").VueConstructor<import("vue").default> & (new (...args: any[]) => import("@vue/composition-api").ComponentRenderProxy<{
6
+ [x: string]: any;
7
+ } & {}, import("@vue/composition-api").ShallowUnwrapRef<any>, import("@vue/composition-api").Data, {}, {}, {
8
+ [x: string]: any;
9
+ } & {}, {
10
+ [x: string]: any;
11
+ }, true>);
12
+ export default _sfc_main;