zartui 2.1.4 → 2.1.6

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.
@@ -10,6 +10,22 @@ var _createNamespace = createNamespace('hierarchy-select'),
10
10
  createComponent = _createNamespace[0],
11
11
  bem = _createNamespace[1];
12
12
 
13
+ function pickSlots(instance, keys) {
14
+ var $slots = instance.$slots,
15
+ $scopedSlots = instance.$scopedSlots;
16
+ var scopedSlots = {};
17
+ keys.forEach(function (key) {
18
+ if ($scopedSlots[key]) {
19
+ scopedSlots[key] = $scopedSlots[key];
20
+ } else if ($slots[key]) {
21
+ scopedSlots[key] = function () {
22
+ return $slots[key];
23
+ };
24
+ }
25
+ });
26
+ return scopedSlots;
27
+ }
28
+
13
29
  export default createComponent({
14
30
  props: {
15
31
  treeData: {
@@ -141,7 +157,8 @@ export default createComponent({
141
157
  "clickNext": this.clickNext,
142
158
  "selected": this.selected,
143
159
  "change": this.change
144
- }
160
+ },
161
+ "scopedSlots": pickSlots(this, ['folder', 'leaf'])
145
162
  })])]);
146
163
  }
147
164
  });
@@ -168,6 +168,21 @@ export default createComponent({
168
168
  };
169
169
 
170
170
  unchecked(array);
171
+ },
172
+ renderNode: function renderNode(item) {
173
+ var defaultNode = item[this.textKey];
174
+ var foldeSlot = this.slots('folder', {
175
+ item: item
176
+ });
177
+ var leafSlot = this.slots('leaf', {
178
+ item: item
179
+ });
180
+
181
+ if (item && item.children) {
182
+ return foldeSlot || defaultNode;
183
+ }
184
+
185
+ return leafSlot || defaultNode;
171
186
  }
172
187
  },
173
188
  render: function render(h) {
@@ -177,7 +192,7 @@ export default createComponent({
177
192
  "class": bem()
178
193
  }, [this.dataList.map(function (item, index) {
179
194
  return h("div", {
180
- "class": [bem("score-item"), _this4.isDisabled(item) ? bem("disable-parent") : '', item.disable ? bem("disable") : '']
195
+ "class": [bem("score-item"), _this4.isDisabled(item) ? bem("disable-parent") : '', item.disable ? bem("disable") : '', item && item.children ? bem("score-node") : bem('score-leaf')]
181
196
  }, [_this4.multiple ? h("div", {
182
197
  "class": bem("multiple-button"),
183
198
  "on": {
@@ -186,14 +201,14 @@ export default createComponent({
186
201
  }
187
202
  }
188
203
  }, [_this4.getMultipleDom(item)]) : h(), h("div", {
189
- "class": bem("item-content"),
204
+ "class": [bem("item-content")],
190
205
  "on": {
191
206
  "click": function click() {
192
207
  _this4.selected(item);
193
208
  }
194
209
  },
195
210
  "style": !_this4.multiple && _this4.choosedValue === item[_this4.valueKey] ? 'color:#0091fa;' : ''
196
- }, [item[_this4.textKey]]), h("div", {
211
+ }, [_this4.renderNode(item)]), h("div", {
197
212
  "class": bem("item-nav"),
198
213
  "on": {
199
214
  "click": function click() {
package/es/index.js CHANGED
@@ -75,7 +75,7 @@ import TextEllipsis from './text-ellipsis';
75
75
  import Timeline from './timeline';
76
76
  import Toast from './toast';
77
77
  import Uploader from './uploader';
78
- var version = '2.1.3';
78
+ var version = '2.1.6';
79
79
 
80
80
  function install(Vue) {
81
81
  var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
@@ -22,6 +22,22 @@ var _createNamespace = (0, _utils.createNamespace)('hierarchy-select'),
22
22
  createComponent = _createNamespace[0],
23
23
  bem = _createNamespace[1];
24
24
 
25
+ function pickSlots(instance, keys) {
26
+ var $slots = instance.$slots,
27
+ $scopedSlots = instance.$scopedSlots;
28
+ var scopedSlots = {};
29
+ keys.forEach(function (key) {
30
+ if ($scopedSlots[key]) {
31
+ scopedSlots[key] = $scopedSlots[key];
32
+ } else if ($slots[key]) {
33
+ scopedSlots[key] = function () {
34
+ return $slots[key];
35
+ };
36
+ }
37
+ });
38
+ return scopedSlots;
39
+ }
40
+
25
41
  var _default2 = createComponent({
26
42
  props: {
27
43
  treeData: {
@@ -153,7 +169,8 @@ var _default2 = createComponent({
153
169
  "clickNext": this.clickNext,
154
170
  "selected": this.selected,
155
171
  "change": this.change
156
- }
172
+ },
173
+ "scopedSlots": pickSlots(this, ['folder', 'leaf'])
157
174
  })])]);
158
175
  }
159
176
  });
@@ -178,6 +178,21 @@ var _default2 = createComponent({
178
178
  };
179
179
 
180
180
  unchecked(array);
181
+ },
182
+ renderNode: function renderNode(item) {
183
+ var defaultNode = item[this.textKey];
184
+ var foldeSlot = this.slots('folder', {
185
+ item: item
186
+ });
187
+ var leafSlot = this.slots('leaf', {
188
+ item: item
189
+ });
190
+
191
+ if (item && item.children) {
192
+ return foldeSlot || defaultNode;
193
+ }
194
+
195
+ return leafSlot || defaultNode;
181
196
  }
182
197
  },
183
198
  render: function render(h) {
@@ -187,7 +202,7 @@ var _default2 = createComponent({
187
202
  "class": bem()
188
203
  }, [this.dataList.map(function (item, index) {
189
204
  return h("div", {
190
- "class": [bem("score-item"), _this4.isDisabled(item) ? bem("disable-parent") : '', item.disable ? bem("disable") : '']
205
+ "class": [bem("score-item"), _this4.isDisabled(item) ? bem("disable-parent") : '', item.disable ? bem("disable") : '', item && item.children ? bem("score-node") : bem('score-leaf')]
191
206
  }, [_this4.multiple ? h("div", {
192
207
  "class": bem("multiple-button"),
193
208
  "on": {
@@ -196,14 +211,14 @@ var _default2 = createComponent({
196
211
  }
197
212
  }
198
213
  }, [_this4.getMultipleDom(item)]) : h(), h("div", {
199
- "class": bem("item-content"),
214
+ "class": [bem("item-content")],
200
215
  "on": {
201
216
  "click": function click() {
202
217
  _this4.selected(item);
203
218
  }
204
219
  },
205
220
  "style": !_this4.multiple && _this4.choosedValue === item[_this4.valueKey] ? 'color:#0091fa;' : ''
206
- }, [item[_this4.textKey]]), h("div", {
221
+ }, [_this4.renderNode(item)]), h("div", {
207
222
  "class": bem("item-nav"),
208
223
  "on": {
209
224
  "click": function click() {
package/lib/index.js CHANGED
@@ -313,7 +313,7 @@ exports.Toast = _toast.default;
313
313
  var _uploader = _interopRequireDefault(require("./uploader"));
314
314
 
315
315
  exports.Uploader = _uploader.default;
316
- var version = '2.1.3';
316
+ var version = '2.1.6';
317
317
  exports.version = version;
318
318
 
319
319
  function install(Vue) {