@opentinyvue/vue-grid-select 3.26.0 → 3.28.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/index.d.ts CHANGED
@@ -9,5 +9,5 @@
9
9
  * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
10
  *
11
11
  */
12
- import GridSelect from './src/pc.vue';
12
+ import GridSelect from './src/index';
13
13
  export default GridSelect;
package/lib/index.js CHANGED
@@ -1,83 +1,77 @@
1
- import { defineComponent, $prefix, setup } from '@opentinyvue/vue-common';
2
- import { renderless, api } from '@opentinyvue/vue-renderless/grid-select/vue';
3
- import Grid from '@opentinyvue/vue-grid';
4
- import BaseSelect from '@opentinyvue/vue-base-select';
5
- import { resolveComponent, openBlock, createBlock, withCtx, createVNode, mergeProps, withModifiers } from 'vue';
6
-
7
- function _createForOfIteratorHelperLoose(r, e) {
8
- var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
9
- if (t) return (t = t.call(r)).next.bind(t);
10
- if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
11
- t && (r = t);
12
- var o = 0;
13
- return function() {
14
- return o >= r.length ? { done: true } : { done: false, value: r[o++] };
15
- };
16
- }
17
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
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);
18
9
  }
19
- function _unsupportedIterableToArray(r, a) {
20
- if (r) {
21
- if ("string" == typeof r) return _arrayLikeToArray(r, a);
22
- var t = {}.toString.call(r).slice(8, -1);
23
- return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
10
+ import { defineComponent, $props, $setup, $prefix } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileFirstTemplate from "./mobile-first.js";
13
+ var template = function template2(mode) {
14
+ var _process$env;
15
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
16
+ if ("pc" === (tinyMode || mode)) {
17
+ return PcTemplate;
24
18
  }
25
- }
26
- function _arrayLikeToArray(r, a) {
27
- (null == a || a > r.length) && (a = r.length);
28
- for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
29
- return n;
30
- }
31
- var _export_sfc = function _export_sfc2(sfc, props) {
32
- var target = sfc.__vccOpts || sfc;
33
- for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
34
- var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
35
- target[key] = val;
19
+ if ("mobile-first" === (tinyMode || mode)) {
20
+ return MobileFirstTemplate;
36
21
  }
37
- return target;
22
+ return PcTemplate;
38
23
  };
39
-
40
- var _sfc_main = defineComponent({
24
+ var GridSelect = defineComponent({
41
25
  name: $prefix + "GridSelect",
42
- components: {
43
- TinyGrid: Grid,
44
- TinyBaseSelect: BaseSelect
45
- },
46
- props: {
26
+ componentName: "GridSelect",
27
+ props: _extends({}, $props, {
28
+ // 基础 props
47
29
  clearable: Boolean,
48
- extraQueryParams: {
49
- type: [Object, String, Boolean, Array, Number],
50
- default: ""
30
+ disabled: Boolean,
31
+ size: String,
32
+ placeholder: String,
33
+ readonly: Boolean,
34
+ modelValue: {},
35
+ multiple: Boolean,
36
+ // 弹框相关
37
+ popperClass: String,
38
+ popperAppendToBody: {
39
+ type: Boolean,
40
+ default: true
51
41
  },
52
- filterable: Boolean,
53
- filterMethod: Function,
54
- gridOp: {
42
+ placement: {
43
+ type: String,
44
+ default: "bottom-start"
45
+ },
46
+ dropStyle: {
55
47
  type: Object,
56
48
  default: function _default() {
57
49
  return {};
58
50
  }
59
51
  },
60
- initLabel: {
52
+ // 标签相关
53
+ collapseTags: Boolean,
54
+ copyable: Boolean,
55
+ textSplit: {
61
56
  type: String,
62
- default: ""
57
+ default: ","
63
58
  },
64
- initQuery: Function,
65
- modelValue: {},
66
- multiple: Boolean,
67
- radioConfig: {
68
- type: Object,
69
- default: function _default2() {
70
- return {
71
- checkMethod: function checkMethod() {
72
- return true;
73
- }
74
- };
75
- }
59
+ hoverExpand: Boolean,
60
+ clickExpand: Boolean,
61
+ showTips: {
62
+ type: Boolean,
63
+ default: true
76
64
  },
65
+ // 搜索和过滤
66
+ filterable: Boolean,
67
+ filterMethod: Function,
68
+ searchable: Boolean,
69
+ // 远程搜索
77
70
  remote: Boolean,
71
+ remoteMethod: Function,
78
72
  remoteConfig: {
79
73
  type: Object,
80
- default: function _default3() {
74
+ default: function _default2() {
81
75
  return {
82
76
  showIcon: false,
83
77
  clearData: false,
@@ -85,8 +79,19 @@ var _sfc_main = defineComponent({
85
79
  };
86
80
  }
87
81
  },
88
- remoteMethod: Function,
89
82
  reserveKeyword: Boolean,
83
+ extraQueryParams: {
84
+ type: [Object, String, Boolean, Array, Number],
85
+ default: ""
86
+ },
87
+ initQuery: Function,
88
+ // 表格配置
89
+ gridOp: {
90
+ type: Object,
91
+ default: function _default3() {
92
+ return {};
93
+ }
94
+ },
90
95
  selectConfig: {
91
96
  type: Object,
92
97
  default: function _default4() {
@@ -97,6 +102,17 @@ var _sfc_main = defineComponent({
97
102
  };
98
103
  }
99
104
  },
105
+ radioConfig: {
106
+ type: Object,
107
+ default: function _default5() {
108
+ return {
109
+ checkMethod: function checkMethod() {
110
+ return true;
111
+ }
112
+ };
113
+ }
114
+ },
115
+ // 字段映射
100
116
  textField: {
101
117
  type: String,
102
118
  default: "label"
@@ -104,57 +120,30 @@ var _sfc_main = defineComponent({
104
120
  valueField: {
105
121
  type: String,
106
122
  default: "value"
123
+ },
124
+ // 多选相关
125
+ multipleLimit: {
126
+ type: Number,
127
+ default: 0
107
128
  }
108
- },
109
- setup: function setup$1(props, context) {
110
- return setup({
129
+ }),
130
+ setup: function setup(props, context) {
131
+ return $setup({
111
132
  props,
112
133
  context,
113
- renderless,
114
- api
134
+ template
115
135
  });
116
136
  }
117
137
  });
118
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
119
- var _component_tiny_grid = resolveComponent("tiny-grid");
120
- var _component_tiny_base_select = resolveComponent("tiny-base-select");
121
- return openBlock(), createBlock(_component_tiny_base_select, {
122
- ref: "baseSelectRef",
123
- class: "tiny-grid-select",
124
- modelValue: _ctx.state.value,
125
- "onUpdate:modelValue": _cache[1] || (_cache[1] = function($event) {
126
- return _ctx.state.value = $event;
127
- }),
128
- multiple: _ctx.multiple,
129
- filterable: _ctx.filterable,
130
- "filter-method": _ctx.filter
131
- }, {
132
- panel: withCtx(function() {
133
- return [createVNode(_component_tiny_grid, mergeProps({
134
- ref: "gridRef",
135
- "auto-resize": "",
136
- "row-id": _ctx.valueField,
137
- "select-config": _ctx.buildSelectConfig(),
138
- "radio-config": _ctx.buildRadioConfig(),
139
- "highlight-current-row": true,
140
- columns: _ctx.state.gridData.columns,
141
- data: _ctx.state.gridData,
142
- onSelectAll: _ctx.selectChange,
143
- onSelectChange: _ctx.selectChange,
144
- onRadioChange: _ctx.radioChange,
145
- onMousedown: _cache[0] || (_cache[0] = withModifiers(function() {
146
- }, ["stop"]))
147
- }, _ctx.gridOp), null, 16, ["row-id", "select-config", "radio-config", "columns", "data", "onSelectAll", "onSelectChange", "onRadioChange"])];
148
- }),
149
- _: 1
150
- /* STABLE */
151
- }, 8, ["modelValue", "multiple", "filterable", "filter-method"]);
152
- }
153
- var GridSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
154
138
  var version = "3.undefined";
139
+ GridSelect.model = {
140
+ prop: "modelValue",
141
+ event: "update:modelValue"
142
+ };
155
143
  GridSelect.install = function(Vue) {
156
144
  Vue.component(GridSelect.name, GridSelect);
157
145
  };
158
146
  GridSelect.version = version;
159
-
160
- export { GridSelect as default };
147
+ export {
148
+ GridSelect as default
149
+ };
@@ -0,0 +1,230 @@
1
+ import { defineComponent, $prefix, props, setup } from '@opentinyvue/vue-common';
2
+ import { renderless, api } from '@opentinyvue/vue-renderless/grid-select/vue';
3
+ import Grid from '@opentinyvue/vue-grid';
4
+ import BaseSelect from '@opentinyvue/vue-base-select';
5
+ import { resolveComponent, openBlock, createBlock, withCtx, createVNode, mergeProps, withModifiers } from 'vue';
6
+
7
+ function _createForOfIteratorHelperLoose(r, e) {
8
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
9
+ if (t) return (t = t.call(r)).next.bind(t);
10
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
11
+ t && (r = t);
12
+ var o = 0;
13
+ return function() {
14
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
15
+ };
16
+ }
17
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
18
+ }
19
+ function _unsupportedIterableToArray(r, a) {
20
+ if (r) {
21
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
22
+ var t = {}.toString.call(r).slice(8, -1);
23
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
24
+ }
25
+ }
26
+ function _arrayLikeToArray(r, a) {
27
+ (null == a || a > r.length) && (a = r.length);
28
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
29
+ return n;
30
+ }
31
+ var _export_sfc = function _export_sfc2(sfc, props) {
32
+ var target = sfc.__vccOpts || sfc;
33
+ for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
34
+ var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
35
+ target[key] = val;
36
+ }
37
+ return target;
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 _sfc_main = defineComponent({
50
+ name: $prefix + "GridSelect",
51
+ components: {
52
+ TinyGrid: Grid,
53
+ TinyBaseSelect: BaseSelect
54
+ },
55
+ props: _extends({}, props, {
56
+ // 基础 props
57
+ clearable: Boolean,
58
+ disabled: Boolean,
59
+ size: String,
60
+ placeholder: String,
61
+ readonly: Boolean,
62
+ modelValue: {},
63
+ multiple: Boolean,
64
+ // 弹框相关
65
+ popperClass: String,
66
+ popperAppendToBody: {
67
+ type: Boolean,
68
+ default: true
69
+ },
70
+ placement: {
71
+ type: String,
72
+ default: "bottom-start"
73
+ },
74
+ dropStyle: {
75
+ type: Object,
76
+ default: function _default() {
77
+ return {};
78
+ }
79
+ },
80
+ // 标签相关
81
+ collapseTags: Boolean,
82
+ copyable: Boolean,
83
+ textSplit: {
84
+ type: String,
85
+ default: ","
86
+ },
87
+ hoverExpand: Boolean,
88
+ clickExpand: Boolean,
89
+ showTips: {
90
+ type: Boolean,
91
+ default: true
92
+ },
93
+ // 搜索和过滤
94
+ filterable: Boolean,
95
+ filterMethod: Function,
96
+ searchable: Boolean,
97
+ // 远程搜索
98
+ remote: Boolean,
99
+ remoteMethod: Function,
100
+ remoteConfig: {
101
+ type: Object,
102
+ default: function _default2() {
103
+ return {
104
+ showIcon: false,
105
+ clearData: false,
106
+ autoSearch: false
107
+ };
108
+ }
109
+ },
110
+ reserveKeyword: Boolean,
111
+ extraQueryParams: {
112
+ type: [Object, String, Boolean, Array, Number],
113
+ default: ""
114
+ },
115
+ initQuery: Function,
116
+ // 表格配置
117
+ gridOp: {
118
+ type: Object,
119
+ default: function _default3() {
120
+ return {};
121
+ }
122
+ },
123
+ selectConfig: {
124
+ type: Object,
125
+ default: function _default4() {
126
+ return {
127
+ checkMethod: function checkMethod() {
128
+ return true;
129
+ }
130
+ };
131
+ }
132
+ },
133
+ radioConfig: {
134
+ type: Object,
135
+ default: function _default5() {
136
+ return {
137
+ checkMethod: function checkMethod() {
138
+ return true;
139
+ }
140
+ };
141
+ }
142
+ },
143
+ // 字段映射
144
+ textField: {
145
+ type: String,
146
+ default: "label"
147
+ },
148
+ valueField: {
149
+ type: String,
150
+ default: "value"
151
+ },
152
+ // 多选相关
153
+ multipleLimit: {
154
+ type: Number,
155
+ default: 0
156
+ }
157
+ }),
158
+ setup: function setup$1(props2, context) {
159
+ return setup({
160
+ props: props2,
161
+ context,
162
+ renderless,
163
+ api
164
+ });
165
+ }
166
+ });
167
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
168
+ var _component_tiny_grid = resolveComponent("tiny-grid");
169
+ var _component_tiny_base_select = resolveComponent("tiny-base-select");
170
+ return openBlock(), createBlock(_component_tiny_base_select, {
171
+ ref: "baseSelectRef",
172
+ "data-tag": "tiny-grid-select",
173
+ modelValue: _ctx.state.modelValue,
174
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = function($event) {
175
+ return _ctx.state.modelValue = $event;
176
+ }),
177
+ clearable: _ctx.clearable,
178
+ multiple: _ctx.multiple,
179
+ filterable: _ctx.filterable,
180
+ "filter-method": _ctx.filter,
181
+ "text-field": _ctx.textField,
182
+ "value-field": _ctx.valueField,
183
+ size: _ctx.size,
184
+ disabled: _ctx.disabled,
185
+ placeholder: _ctx.placeholder,
186
+ readonly: _ctx.readonly,
187
+ "popper-class": _ctx.popperClass,
188
+ "popper-append-to-body": _ctx.popperAppendToBody,
189
+ placement: _ctx.placement,
190
+ "drop-style": _ctx.dropStyle,
191
+ "hover-expand": _ctx.hoverExpand,
192
+ "click-expand": _ctx.clickExpand,
193
+ "collapse-tags": _ctx.collapseTags,
194
+ copyable: _ctx.copyable,
195
+ "text-split": _ctx.textSplit,
196
+ "show-tips": _ctx.showTips,
197
+ searchable: _ctx.searchable,
198
+ "multiple-limit": _ctx.multipleLimit,
199
+ remote: _ctx.remote,
200
+ "remote-method": _ctx.remoteMethod,
201
+ "init-query": _ctx.initQuery,
202
+ "extra-query-params": _ctx.extraQueryParams,
203
+ "remote-config": _ctx.remoteConfig,
204
+ onVisibleChange: _ctx.handleVisibleChange
205
+ }, {
206
+ panel: withCtx(function() {
207
+ var _ctx$gridOp, _ctx$state$gridData;
208
+ return [createVNode(_component_tiny_grid, mergeProps({
209
+ ref: "gridRef",
210
+ "auto-resize": "",
211
+ "row-id": _ctx.valueField,
212
+ "select-config": _ctx.buildSelectConfig(),
213
+ "radio-config": _ctx.buildRadioConfig(),
214
+ "highlight-current-row": true,
215
+ columns: ((_ctx$gridOp = _ctx.gridOp) == null ? void 0 : _ctx$gridOp.columns) || [],
216
+ data: Array.isArray(_ctx.state.gridData) ? _ctx.state.gridData : ((_ctx$state$gridData = _ctx.state.gridData) == null ? void 0 : _ctx$state$gridData.data) || _ctx.state.gridData || [],
217
+ onSelectAll: _ctx.selectChange,
218
+ onSelectChange: _ctx.selectChange,
219
+ onRadioChange: _ctx.radioChange,
220
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(function() {
221
+ }, ["stop"]))
222
+ }, _ctx.gridOp), null, 16, ["row-id", "select-config", "radio-config", "columns", "data", "onSelectAll", "onSelectChange", "onRadioChange"])];
223
+ }),
224
+ _: 1
225
+ /* STABLE */
226
+ }, 8, ["modelValue", "clearable", "multiple", "filterable", "filter-method", "text-field", "value-field", "size", "disabled", "placeholder", "readonly", "popper-class", "popper-append-to-body", "placement", "drop-style", "hover-expand", "click-expand", "collapse-tags", "copyable", "text-split", "show-tips", "searchable", "multiple-limit", "remote", "remote-method", "init-query", "extra-query-params", "remote-config", "onVisibleChange"]);
227
+ }
228
+ var mobileFirst = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
229
+
230
+ export { mobileFirst as default };