@tarojs/components 3.6.0-canary.7 → 3.6.0-canary.8
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/dist/react/component-lib/index.js +20 -10
- package/dist/react/component-lib/input.js +2 -3
- package/dist/react/component-lib/reactify-wc.js +6 -43
- package/dist/react/components.js +0 -2
- package/dist/react/react-component-lib/createComponent.js +9 -29
- package/dist/react/react-component-lib/createOverlayComponent.js +2 -29
- package/dist/react/react-component-lib/utils/attachProps.js +9 -18
- package/dist/react/react-component-lib/utils/index.js +0 -2
- package/dist/vue2/component-lib/components.js +22 -11
- package/dist/vue2/component-lib/createFormsComponent.js +0 -5
- package/dist/vue2/component-lib/index.js +6 -8
- package/dist/vue2/component-lib/mixins/refs.js +0 -5
- package/dist/vue2/components.js +0 -3
- package/dist/vue2/index.js +3 -7
- package/dist/vue2/vue-component-lib/utils.js +0 -1
- package/dist/vue3/component-lib/createComponent.js +1 -1
- package/dist/vue3/component-lib/createFormsComponent.js +3 -8
- package/dist/vue3/component-lib/forwardRef.js +0 -2
- package/dist/vue3/component-lib/icon.js +2 -2
- package/dist/vue3/component-lib/image.js +2 -2
- package/dist/vue3/component-lib/index.js +22 -11
- package/dist/vue3/component-lib/scroll-view.js +2 -2
- package/dist/vue3/component-lib/text.js +2 -2
- package/dist/vue3/components.js +0 -2
- package/dist/vue3/index.js +2 -4
- package/dist/vue3/vue-component-lib/utils.js +7 -29
- package/package.json +4 -4
- package/types/Button.d.ts +1 -1
- package/types/Camera.d.ts +1 -1
- package/types/Checkbox.d.ts +1 -1
- package/types/CheckboxGroup.d.ts +1 -1
- package/types/CoverImage.d.ts +1 -1
- package/types/CustomWrapper.d.ts +1 -0
- package/types/Form.d.ts +1 -1
- package/types/Icon.d.ts +1 -1
- package/types/Image.d.ts +1 -1
- package/types/Input.d.ts +15 -1
- package/types/Label.d.ts +1 -1
- package/types/NativeSlot.d.ts +1 -0
- package/types/NavigationBar.d.ts +2 -1
- package/types/Navigator.d.ts +1 -1
- package/types/Picker.d.ts +1 -1
- package/types/PickerView.d.ts +1 -1
- package/types/PickerViewColumn.d.ts +1 -1
- package/types/Progress.d.ts +1 -1
- package/types/Radio.d.ts +1 -1
- package/types/RadioGroup.d.ts +1 -1
- package/types/RichText.d.ts +1 -1
- package/types/ScrollView.d.ts +1 -1
- package/types/ShareElement.d.ts +3 -3
- package/types/Slider.d.ts +1 -1
- package/types/Slot.d.ts +2 -1
- package/types/Swiper.d.ts +1 -1
- package/types/SwiperItem.d.ts +1 -1
- package/types/Switch.d.ts +1 -1
- package/types/Textarea.d.ts +1 -1
- package/types/Video.d.ts +1 -1
- package/types/View.d.ts +1 -1
- package/types/WebView.d.ts +1 -1
|
@@ -3,13 +3,15 @@ import Image from './image';
|
|
|
3
3
|
import Picker from './picker';
|
|
4
4
|
import ScrollView from './scroll-view';
|
|
5
5
|
import Text from './text';
|
|
6
|
-
var components = [
|
|
6
|
+
var components = [
|
|
7
|
+
// 视图容器
|
|
7
8
|
'taro-cover-image', 'taro-cover-view', 'taro-match-media', 'taro-movable-area', 'taro-movable-view', 'taro-page-container', 'taro-root-portal', ['taro-scroll-view', {
|
|
8
9
|
type: 'component',
|
|
9
10
|
component: ScrollView
|
|
10
11
|
}], 'taro-share-element', 'taro-swiper', ['taro-swiper-item', {
|
|
11
12
|
classNames: ['swiper-slide']
|
|
12
|
-
}], 'taro-view',
|
|
13
|
+
}], 'taro-view',
|
|
14
|
+
// 基础内容
|
|
13
15
|
['taro-icon', {
|
|
14
16
|
type: 'component',
|
|
15
17
|
component: Icon
|
|
@@ -18,7 +20,8 @@ var components = [// 视图容器
|
|
|
18
20
|
}], 'taro-rich-text', ['taro-text', {
|
|
19
21
|
type: 'component',
|
|
20
22
|
component: Text
|
|
21
|
-
}],
|
|
23
|
+
}],
|
|
24
|
+
// 表单组件
|
|
22
25
|
'taro-button', ['taro-checkbox', {
|
|
23
26
|
classNames: ['weui-cells_checkbox']
|
|
24
27
|
}], 'taro-checkbox-group', 'taro-editor', 'taro-form', ['taro-input', {
|
|
@@ -43,18 +46,26 @@ var components = [// 视图容器
|
|
|
43
46
|
}], ['taro-textarea', {
|
|
44
47
|
type: 'forms',
|
|
45
48
|
event: 'input'
|
|
46
|
-
}],
|
|
47
|
-
|
|
49
|
+
}],
|
|
50
|
+
// 导航
|
|
51
|
+
'taro-functional-page-navigator', 'taro-navigator',
|
|
52
|
+
// 媒体组件
|
|
48
53
|
'taro-audio', 'taro-camera', ['taro-image', {
|
|
49
54
|
type: 'component',
|
|
50
55
|
component: Image
|
|
51
56
|
}], 'taro-live-player', ['taro-video', {
|
|
52
57
|
classNames: ['taro-video-container']
|
|
53
|
-
}], 'taro-voip-room',
|
|
54
|
-
|
|
55
|
-
'taro-
|
|
56
|
-
|
|
57
|
-
'taro-
|
|
58
|
-
|
|
58
|
+
}], 'taro-voip-room',
|
|
59
|
+
// 地图
|
|
60
|
+
'taro-map',
|
|
61
|
+
// 画布
|
|
62
|
+
'taro-canvas',
|
|
63
|
+
// 开放能力
|
|
64
|
+
'taro-web-view', 'taro-ad', 'taro-ad-custom', 'taro-official-account', 'taro-open-data',
|
|
65
|
+
// 导航栏
|
|
66
|
+
'taro-navigation-bar',
|
|
67
|
+
// 页面属性配置节点
|
|
68
|
+
'taro-page-meta',
|
|
69
|
+
// 其他
|
|
59
70
|
'taro-block', 'taro-custom-wrapper', 'taro-slot'];
|
|
60
71
|
export default components;
|
|
@@ -10,11 +10,9 @@ export default function createFormsComponent(name, event) {
|
|
|
10
10
|
type: Object
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
|
|
14
13
|
if (name === 'taro-input') {
|
|
15
14
|
props.focus = Boolean;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
return {
|
|
19
17
|
name: name,
|
|
20
18
|
mixins: [listeners, refs],
|
|
@@ -37,13 +35,10 @@ export default function createFormsComponent(name, event) {
|
|
|
37
35
|
// eslint-disable-next-line
|
|
38
36
|
var self = this;
|
|
39
37
|
var attrs = this.$attrs || {};
|
|
40
|
-
|
|
41
38
|
if (name === 'taro-input') {
|
|
42
39
|
attrs['auto-focus'] = self.focus;
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
var on = _objectSpread({}, self.listeners);
|
|
46
|
-
|
|
47
42
|
on[event] = self[event];
|
|
48
43
|
return createElement("".concat(name, "-core"), {
|
|
49
44
|
class: ['hydrated'].concat(_toConsumableArray(classNames)),
|
|
@@ -8,19 +8,17 @@ components.forEach(function (params) {
|
|
|
8
8
|
Vue.component(params, createComponent(params));
|
|
9
9
|
} else if (params instanceof Array) {
|
|
10
10
|
var _ref = params,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
12
|
+
name = _ref2[0],
|
|
13
|
+
props = _ref2[1];
|
|
15
14
|
var classNames = props.classNames,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
_props$type = props.type,
|
|
16
|
+
type = _props$type === void 0 ? 'simple' : _props$type;
|
|
19
17
|
if (type === 'simple') {
|
|
20
18
|
Vue.component(name, createComponent(name, classNames));
|
|
21
19
|
} else if (type === 'forms') {
|
|
22
20
|
var event = props.event,
|
|
23
|
-
|
|
21
|
+
modelValue = props.modelValue;
|
|
24
22
|
Vue.component(name, createFormsComponent(name, event, modelValue, classNames));
|
|
25
23
|
} else if (type === 'component') {
|
|
26
24
|
Vue.component(name, props.component);
|
|
@@ -3,20 +3,17 @@ export var refs = {
|
|
|
3
3
|
mounted: function mounted() {
|
|
4
4
|
if (this.$parent && _typeof(this.$parent.$refs) === 'object' && Object.keys(this.$parent.$refs).length) {
|
|
5
5
|
var _refs = this.$parent.$refs;
|
|
6
|
-
|
|
7
6
|
if (this._refCacheKey) {
|
|
8
7
|
_refs[this._refCacheKey] = this.$el;
|
|
9
8
|
} else {
|
|
10
9
|
for (var key in _refs) {
|
|
11
10
|
var ref = _refs[key];
|
|
12
|
-
|
|
13
11
|
if (ref === this) {
|
|
14
12
|
this._refCacheKey = key;
|
|
15
13
|
_refs[key] = this.$el;
|
|
16
14
|
break;
|
|
17
15
|
} else if (Array.isArray(ref)) {
|
|
18
16
|
var index = ref.indexOf(this);
|
|
19
|
-
|
|
20
17
|
if (index > -1) {
|
|
21
18
|
ref[index] = this.$el;
|
|
22
19
|
break;
|
|
@@ -29,14 +26,12 @@ export var refs = {
|
|
|
29
26
|
beforeDestroy: function beforeDestroy() {
|
|
30
27
|
if (this.$parent && _typeof(this.$parent.$refs) === 'object' && Object.keys(this.$parent.$refs).length) {
|
|
31
28
|
var _refs2 = this.$parent.$refs;
|
|
32
|
-
|
|
33
29
|
if (this._refCacheKey) {
|
|
34
30
|
_refs2[this._refCacheKey] = this;
|
|
35
31
|
} else {
|
|
36
32
|
for (var key in _refs2) {
|
|
37
33
|
if (Array.isArray(_refs2[key])) {
|
|
38
34
|
var index = _refs2[key].indexOf(this.$el);
|
|
39
|
-
|
|
40
35
|
if (index > -1) {
|
|
41
36
|
_refs2[key][index] = this;
|
|
42
37
|
break;
|
package/dist/vue2/components.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
|
|
3
2
|
/* eslint-disable */
|
|
4
|
-
|
|
5
3
|
/* tslint:disable */
|
|
6
|
-
|
|
7
4
|
/* auto-generated vue proxies */
|
|
8
5
|
import Vue from 'vue';
|
|
9
6
|
import { createCommonRender, createCommonMethod } from './vue-component-lib/utils';
|
package/dist/vue2/index.js
CHANGED
|
@@ -4,19 +4,15 @@ import Vue from 'vue';
|
|
|
4
4
|
import * as components from './components';
|
|
5
5
|
export function initVue2Components() {
|
|
6
6
|
var _Vue$config$ignoredEl;
|
|
7
|
-
|
|
8
7
|
var ignoredElements = [/^taro-/, 'root', 'block'];
|
|
9
|
-
|
|
10
8
|
if (!((_Vue$config$ignoredEl = Vue.config.ignoredElements) !== null && _Vue$config$ignoredEl !== void 0 && _Vue$config$ignoredEl.includes(ignoredElements[0]))) {
|
|
11
9
|
Vue.config.ignoredElements = [].concat(_toConsumableArray(Vue.config.ignoredElements), ignoredElements);
|
|
12
10
|
}
|
|
13
|
-
|
|
14
11
|
Object.entries(components).forEach(function (params) {
|
|
15
12
|
var _ref = params,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
14
|
+
name = _ref2[0],
|
|
15
|
+
definition = _ref2[1];
|
|
20
16
|
if (definition) {
|
|
21
17
|
var tagName = 'taro' + name.replace(new RegExp('([A-Z])', 'g'), '-$1').toLowerCase();
|
|
22
18
|
Vue.component(tagName, definition);
|
|
@@ -27,7 +27,6 @@ export var createCommonRender = function createCommonRender(tagName) {
|
|
|
27
27
|
export var createCommonMethod = function createCommonMethod(methodName) {
|
|
28
28
|
return function () {
|
|
29
29
|
var _this$$refs$wc;
|
|
30
|
-
|
|
31
30
|
(_this$$refs$wc = this.$refs.wc)[methodName].apply(_this$$refs$wc, arguments);
|
|
32
31
|
};
|
|
33
32
|
};
|
|
@@ -7,7 +7,7 @@ export default function createComponent(name) {
|
|
|
7
7
|
emits: ['tap'],
|
|
8
8
|
setup: function setup(__props, _ref) {
|
|
9
9
|
var slots = _ref.slots,
|
|
10
|
-
|
|
10
|
+
emit = _ref.emit;
|
|
11
11
|
var forwardRef = useForwardRef();
|
|
12
12
|
return function () {
|
|
13
13
|
return h("".concat(name, "-core"), {
|
|
@@ -9,25 +9,20 @@ export default function createFormsComponent(name, eventName) {
|
|
|
9
9
|
var props = {
|
|
10
10
|
modelValue: null
|
|
11
11
|
};
|
|
12
|
-
|
|
13
12
|
if (name === 'taro-input') {
|
|
14
13
|
props.focus = Boolean;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
return {
|
|
18
16
|
emits: ['tap', 'update:modelValue'],
|
|
19
17
|
props: props,
|
|
20
18
|
setup: function setup(props, _ref) {
|
|
21
19
|
var slots = _ref.slots,
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
emit = _ref.emit;
|
|
24
21
|
var _toRefs = toRefs(props),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
model = _toRefs.modelValue,
|
|
23
|
+
focus = _toRefs.focus;
|
|
28
24
|
var attrs = computed(function () {
|
|
29
25
|
var _ref2;
|
|
30
|
-
|
|
31
26
|
return name === 'taro-input' ? (_ref2 = {}, _defineProperty(_ref2, modelValue, model.value), _defineProperty(_ref2, 'auto-focus', focus.value), _ref2) : _defineProperty({}, modelValue, model.value);
|
|
32
27
|
});
|
|
33
28
|
var forwardRef = useForwardRef();
|
|
@@ -4,8 +4,8 @@ export default {
|
|
|
4
4
|
emits: ['tap'],
|
|
5
5
|
setup: function setup(__props, _ref) {
|
|
6
6
|
var slots = _ref.slots,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
emit = _ref.emit,
|
|
8
|
+
attrs = _ref.attrs;
|
|
9
9
|
var iconType = attrs.type.replace(/_/g, '-');
|
|
10
10
|
var forwardRef = useForwardRef();
|
|
11
11
|
return function () {
|
|
@@ -4,8 +4,8 @@ export default {
|
|
|
4
4
|
emits: ['tap'],
|
|
5
5
|
setup: function setup(__props, _ref) {
|
|
6
6
|
var slots = _ref.slots,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
emit = _ref.emit,
|
|
8
|
+
attrs = _ref.attrs;
|
|
9
9
|
var forwardRef = useForwardRef();
|
|
10
10
|
return function () {
|
|
11
11
|
return h('taro-image-core', {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import createComponent from './createComponent';
|
|
2
|
-
import createFormsComponent from './createFormsComponent';
|
|
2
|
+
import createFormsComponent from './createFormsComponent';
|
|
3
3
|
|
|
4
|
+
// 视图容器
|
|
4
5
|
export var CoverImage = createComponent('taro-cover-image');
|
|
5
6
|
export var CoverView = createComponent('taro-cover-view');
|
|
6
7
|
export var MatchMedia = createComponent('taro-match-media');
|
|
@@ -12,13 +13,15 @@ export { default as ScrollView } from './scroll-view';
|
|
|
12
13
|
export var ShareElement = createComponent('taro-share-element');
|
|
13
14
|
export var Swiper = createComponent('taro-swiper');
|
|
14
15
|
export var SwiperItem = createComponent('taro-swiper-item', ['swiper-slide']);
|
|
15
|
-
export var View = createComponent('taro-view');
|
|
16
|
+
export var View = createComponent('taro-view');
|
|
16
17
|
|
|
18
|
+
// 基础内容
|
|
17
19
|
export { default as Icon } from './icon';
|
|
18
20
|
export var Progress = createComponent('taro-progress', ['weui-progress']);
|
|
19
21
|
export var RichText = createComponent('taro-rich-text');
|
|
20
|
-
export { default as Text } from './text';
|
|
22
|
+
export { default as Text } from './text';
|
|
21
23
|
|
|
24
|
+
// 表单组件
|
|
22
25
|
export var Button = createComponent('taro-button');
|
|
23
26
|
export var Checkbox = createComponent('taro-checkbox', ['weui-cells_checkbox']);
|
|
24
27
|
export var CheckboxGroup = createComponent('taro-checkbox-group');
|
|
@@ -34,32 +37,40 @@ export var Radio = createComponent('taro-radio', ['weui-cells_checkbox']);
|
|
|
34
37
|
export var RadioGroup = createComponent('taro-radio-group', ['weui-cells_radiogroup']);
|
|
35
38
|
export var Slider = createFormsComponent('taro-slider', 'change', 'value', ['weui-slider-box']);
|
|
36
39
|
export var Switch = createFormsComponent('taro-switch', 'change', 'checked');
|
|
37
|
-
export var Textarea = createFormsComponent('taro-textarea', 'input');
|
|
40
|
+
export var Textarea = createFormsComponent('taro-textarea', 'input');
|
|
38
41
|
|
|
42
|
+
// 导航
|
|
39
43
|
export var FunctionalPageNavigator = createComponent('taro-functional-page-navigator');
|
|
40
|
-
export var Navigator = createComponent('taro-navigator');
|
|
44
|
+
export var Navigator = createComponent('taro-navigator');
|
|
41
45
|
|
|
46
|
+
// 媒体组件
|
|
42
47
|
export var Audio = createComponent('taro-audio');
|
|
43
48
|
export var Camera = createComponent('taro-camera');
|
|
44
49
|
export { default as Image } from './image';
|
|
45
50
|
export var LivePlayer = createComponent('taro-live-player');
|
|
46
51
|
export var Video = createComponent('taro-video', ['taro-video-container']);
|
|
47
|
-
export var VoipRoom = createComponent('taro-voip-room');
|
|
52
|
+
export var VoipRoom = createComponent('taro-voip-room');
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
// 地图
|
|
55
|
+
export var Map = createComponent('taro-map');
|
|
50
56
|
|
|
51
|
-
|
|
57
|
+
// 画布
|
|
58
|
+
export var Canvas = createComponent('taro-canvas');
|
|
52
59
|
|
|
60
|
+
// 开放能力
|
|
53
61
|
export var WebView = createComponent('taro-web-view');
|
|
54
62
|
export var Ad = createComponent('taro-ad');
|
|
55
63
|
export var AdCustom = createComponent('taro-ad-custom');
|
|
56
64
|
export var OfficialAccount = createComponent('taro-official-account');
|
|
57
|
-
export var OpenData = createComponent('taro-open-data');
|
|
65
|
+
export var OpenData = createComponent('taro-open-data');
|
|
58
66
|
|
|
59
|
-
|
|
67
|
+
// 导航栏
|
|
68
|
+
export var NavigationBar = createComponent('taro-navigation-bar');
|
|
60
69
|
|
|
61
|
-
|
|
70
|
+
// 页面属性配置节点
|
|
71
|
+
export var PageMeta = createComponent('taro-page-meta');
|
|
62
72
|
|
|
73
|
+
// 其他
|
|
63
74
|
export var Block = createComponent('taro-block');
|
|
64
75
|
export var CustomWrapper = createComponent('taro-custom-wrapper');
|
|
65
76
|
export var Slot = createComponent('taro-slot');
|
|
@@ -4,8 +4,8 @@ export default {
|
|
|
4
4
|
emits: ['tap', 'scroll'],
|
|
5
5
|
setup: function setup(__props, _ref) {
|
|
6
6
|
var slots = _ref.slots,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
emit = _ref.emit,
|
|
8
|
+
attrs = _ref.attrs;
|
|
9
9
|
var forwardRef = useForwardRef();
|
|
10
10
|
return function () {
|
|
11
11
|
return h('taro-scroll-view-core', {
|
|
@@ -4,8 +4,8 @@ export default {
|
|
|
4
4
|
emits: ['tap'],
|
|
5
5
|
setup: function setup(__props, _ref) {
|
|
6
6
|
var slots = _ref.slots,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
emit = _ref.emit,
|
|
8
|
+
attrs = _ref.attrs;
|
|
9
9
|
var forwardRef = useForwardRef();
|
|
10
10
|
return function () {
|
|
11
11
|
return h('taro-text-core', {
|
package/dist/vue3/components.js
CHANGED
package/dist/vue3/index.js
CHANGED
|
@@ -4,12 +4,10 @@ export function initVue3Components(app) {
|
|
|
4
4
|
app.config.isCustomElement = function (tag) {
|
|
5
5
|
return /^taro-/.test(tag) || tag === 'root' || tag === 'block';
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
Object.entries(components).forEach(function (_ref) {
|
|
9
8
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
name = _ref2[0],
|
|
10
|
+
component = _ref2[1];
|
|
13
11
|
if (component) {
|
|
14
12
|
var tagName = 'taro' + name.replace(new RegExp('([A-Z])', 'g'), '-$1').toLowerCase();
|
|
15
13
|
app.component(tagName, component);
|
|
@@ -7,6 +7,7 @@ var MODEL_VALUE = 'modelValue';
|
|
|
7
7
|
var ROUTER_LINK_VALUE = 'routerLink';
|
|
8
8
|
var NAV_MANAGER = 'navManager';
|
|
9
9
|
var ROUTER_PROP_PREFIX = 'router';
|
|
10
|
+
|
|
10
11
|
/**
|
|
11
12
|
* Starting in Vue 3.1.0, all properties are
|
|
12
13
|
* added as keys to the props object, even if
|
|
@@ -16,24 +17,21 @@ var ROUTER_PROP_PREFIX = 'router';
|
|
|
16
17
|
* and then check if it is not undefined for Vue >= 3.1.0.
|
|
17
18
|
* See https://github.com/vuejs/vue-next/issues/3889
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
20
|
var EMPTY_PROP = Symbol();
|
|
21
21
|
var DEFAULT_EMPTY_PROP = {
|
|
22
22
|
default: EMPTY_PROP
|
|
23
23
|
};
|
|
24
|
-
|
|
25
24
|
var getComponentClasses = function getComponentClasses(classes) {
|
|
26
25
|
return (classes === null || classes === void 0 ? void 0 : classes.split(' ')) || [];
|
|
27
26
|
};
|
|
28
|
-
|
|
29
27
|
var getElementClasses = function getElementClasses(ref, componentClasses) {
|
|
30
28
|
var _ref$value;
|
|
31
|
-
|
|
32
29
|
var defaultClasses = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
33
30
|
return [].concat(_toConsumableArray(Array.from(((_ref$value = ref.value) === null || _ref$value === void 0 ? void 0 : _ref$value.classList) || [])), _toConsumableArray(defaultClasses)).filter(function (c, i, self) {
|
|
34
31
|
return !componentClasses.has(c) && self.indexOf(c) === i;
|
|
35
32
|
});
|
|
36
33
|
};
|
|
34
|
+
|
|
37
35
|
/**
|
|
38
36
|
* Create a callback to define a Vue component wrapper around a Web Component.
|
|
39
37
|
*
|
|
@@ -48,33 +46,28 @@ var getElementClasses = function getElementClasses(ref, componentClasses) {
|
|
|
48
46
|
* @prop externalModelUpdateEvent - The external event to fire from your Vue component when modelUpdateEvent fires. This is used for ensuring that v-model references have been
|
|
49
47
|
* correctly updated when a user's event callback fires.
|
|
50
48
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
49
|
export var defineContainer = function defineContainer(name, defineCustomElement) {
|
|
54
50
|
var componentProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
55
51
|
var modelProp = arguments.length > 3 ? arguments[3] : undefined;
|
|
56
52
|
var modelUpdateEvent = arguments.length > 4 ? arguments[4] : undefined;
|
|
57
53
|
var externalModelUpdateEvent = arguments.length > 5 ? arguments[5] : undefined;
|
|
58
|
-
|
|
59
54
|
/**
|
|
60
55
|
* Create a Vue component wrapper around a Web Component.
|
|
61
56
|
* Note: The `props` here are not all properties on a component.
|
|
62
57
|
* They refer to whatever properties are set on an instance of a component.
|
|
63
58
|
*/
|
|
59
|
+
|
|
64
60
|
if (defineCustomElement !== undefined) {
|
|
65
61
|
defineCustomElement();
|
|
66
62
|
}
|
|
67
|
-
|
|
68
63
|
var Container = defineComponent(function (props, _ref) {
|
|
69
64
|
var _currentInstance$appC;
|
|
70
|
-
|
|
71
65
|
var attrs = _ref.attrs,
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
slots = _ref.slots,
|
|
67
|
+
emit = _ref.emit;
|
|
74
68
|
var modelPropValue = props[modelProp];
|
|
75
69
|
var containerRef = ref();
|
|
76
70
|
var classes = new Set(getComponentClasses(attrs.class));
|
|
77
|
-
|
|
78
71
|
var onVnodeBeforeMount = function onVnodeBeforeMount(vnode) {
|
|
79
72
|
// Add a listener to tell Vue to update the v-model
|
|
80
73
|
if (vnode.el) {
|
|
@@ -83,6 +76,7 @@ export var defineContainer = function defineContainer(name, defineCustomElement)
|
|
|
83
76
|
vnode.el.addEventListener(eventName.toLowerCase(), function (e) {
|
|
84
77
|
modelPropValue = (e === null || e === void 0 ? void 0 : e.target)[modelProp];
|
|
85
78
|
emit(UPDATE_VALUE_EVENT, modelPropValue);
|
|
79
|
+
|
|
86
80
|
/**
|
|
87
81
|
* We need to emit the change event here
|
|
88
82
|
* rather than on the web component to ensure
|
|
@@ -91,7 +85,6 @@ export var defineContainer = function defineContainer(name, defineCustomElement)
|
|
|
91
85
|
* native web component, but the v-model will
|
|
92
86
|
* not have been updated yet.
|
|
93
87
|
*/
|
|
94
|
-
|
|
95
88
|
if (externalModelUpdateEvent) {
|
|
96
89
|
emit(externalModelUpdateEvent, e);
|
|
97
90
|
}
|
|
@@ -99,72 +92,60 @@ export var defineContainer = function defineContainer(name, defineCustomElement)
|
|
|
99
92
|
});
|
|
100
93
|
}
|
|
101
94
|
};
|
|
102
|
-
|
|
103
95
|
var currentInstance = getCurrentInstance();
|
|
104
96
|
var hasRouter = currentInstance === null || currentInstance === void 0 ? void 0 : (_currentInstance$appC = currentInstance.appContext) === null || _currentInstance$appC === void 0 ? void 0 : _currentInstance$appC.provides[NAV_MANAGER];
|
|
105
97
|
var navManager = hasRouter ? inject(NAV_MANAGER) : undefined;
|
|
106
|
-
|
|
107
98
|
var handleRouterLink = function handleRouterLink(ev) {
|
|
108
99
|
var routerLink = props.routerLink;
|
|
109
100
|
if (routerLink === EMPTY_PROP) return;
|
|
110
|
-
|
|
111
101
|
if (navManager !== undefined) {
|
|
112
102
|
var navigationPayload = {
|
|
113
103
|
event: ev
|
|
114
104
|
};
|
|
115
|
-
|
|
116
105
|
for (var key in props) {
|
|
117
106
|
var value = props[key];
|
|
118
|
-
|
|
119
107
|
if (props.hasOwnProperty(key) && key.startsWith(ROUTER_PROP_PREFIX) && value !== EMPTY_PROP) {
|
|
120
108
|
navigationPayload[key] = value;
|
|
121
109
|
}
|
|
122
110
|
}
|
|
123
|
-
|
|
124
111
|
navManager.navigate(navigationPayload);
|
|
125
112
|
} else {
|
|
126
113
|
console.warn('Tried to navigate, but no router was found. Make sure you have mounted Vue Router.');
|
|
127
114
|
}
|
|
128
115
|
};
|
|
129
|
-
|
|
130
116
|
return function () {
|
|
131
117
|
modelPropValue = props[modelProp];
|
|
132
118
|
getComponentClasses(attrs.class).forEach(function (value) {
|
|
133
119
|
classes.add(value);
|
|
134
120
|
});
|
|
135
121
|
var oldClick = props.onClick;
|
|
136
|
-
|
|
137
122
|
var handleClick = function handleClick(ev) {
|
|
138
123
|
if (oldClick !== undefined) {
|
|
139
124
|
oldClick(ev);
|
|
140
125
|
}
|
|
141
|
-
|
|
142
126
|
if (!ev.defaultPrevented) {
|
|
143
127
|
handleRouterLink(ev);
|
|
144
128
|
}
|
|
145
129
|
};
|
|
146
|
-
|
|
147
130
|
var propsToAdd = {
|
|
148
131
|
ref: containerRef,
|
|
149
132
|
class: getElementClasses(containerRef, classes),
|
|
150
133
|
onClick: handleClick,
|
|
151
134
|
onVnodeBeforeMount: modelUpdateEvent ? onVnodeBeforeMount : undefined
|
|
152
135
|
};
|
|
136
|
+
|
|
153
137
|
/**
|
|
154
138
|
* We can use Object.entries here
|
|
155
139
|
* to avoid the hasOwnProperty check,
|
|
156
140
|
* but that would require 2 iterations
|
|
157
141
|
* where as this only requires 1.
|
|
158
142
|
*/
|
|
159
|
-
|
|
160
143
|
for (var key in props) {
|
|
161
144
|
var value = props[key];
|
|
162
|
-
|
|
163
145
|
if (props.hasOwnProperty(key) && value !== EMPTY_PROP) {
|
|
164
146
|
propsToAdd[key] = value;
|
|
165
147
|
}
|
|
166
148
|
}
|
|
167
|
-
|
|
168
149
|
if (modelProp) {
|
|
169
150
|
/**
|
|
170
151
|
* If form value property was set using v-model
|
|
@@ -178,7 +159,6 @@ export var defineContainer = function defineContainer(name, defineCustomElement)
|
|
|
178
159
|
propsToAdd = _objectSpread(_objectSpread({}, propsToAdd), {}, _defineProperty({}, modelProp, modelPropValue));
|
|
179
160
|
}
|
|
180
161
|
}
|
|
181
|
-
|
|
182
162
|
return h(name, propsToAdd, slots.default && slots.default());
|
|
183
163
|
};
|
|
184
164
|
});
|
|
@@ -187,11 +167,9 @@ export var defineContainer = function defineContainer(name, defineCustomElement)
|
|
|
187
167
|
componentProps.forEach(function (componentProp) {
|
|
188
168
|
Container.props[componentProp] = DEFAULT_EMPTY_PROP;
|
|
189
169
|
});
|
|
190
|
-
|
|
191
170
|
if (modelProp) {
|
|
192
171
|
Container.props[MODEL_VALUE] = DEFAULT_EMPTY_PROP;
|
|
193
172
|
Container.emits = [UPDATE_VALUE_EVENT, externalModelUpdateEvent];
|
|
194
173
|
}
|
|
195
|
-
|
|
196
174
|
return Container;
|
|
197
175
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/components",
|
|
3
|
-
"version": "3.6.0-canary.
|
|
3
|
+
"version": "3.6.0-canary.8",
|
|
4
4
|
"description": "Taro 组件库",
|
|
5
5
|
"browser": "dist/index.js",
|
|
6
6
|
"main:h5": "dist/index.js",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"resolve-pathname": "^3.0.0",
|
|
36
36
|
"swiper": "6.8.0",
|
|
37
37
|
"weui": "^1.1.2",
|
|
38
|
-
"@tarojs/components-advanced": "3.6.0-canary.
|
|
39
|
-
"@tarojs/router": "3.6.0-canary.
|
|
40
|
-
"@tarojs/taro": "3.6.0-canary.
|
|
38
|
+
"@tarojs/components-advanced": "3.6.0-canary.8",
|
|
39
|
+
"@tarojs/router": "3.6.0-canary.8",
|
|
40
|
+
"@tarojs/taro": "3.6.0-canary.8"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@babel/generator": "^7.14.5",
|
package/types/Button.d.ts
CHANGED
|
@@ -526,7 +526,7 @@ declare namespace ButtonProps {
|
|
|
526
526
|
|
|
527
527
|
/** 按钮
|
|
528
528
|
* @classification forms
|
|
529
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
529
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
|
|
530
530
|
* @example_react
|
|
531
531
|
* ```tsx
|
|
532
532
|
* export default class PageButton extends Component {
|
package/types/Camera.d.ts
CHANGED
|
@@ -149,7 +149,7 @@ declare namespace CameraProps {
|
|
|
149
149
|
|
|
150
150
|
/** 系统相机
|
|
151
151
|
* @classification media
|
|
152
|
-
* @supported weapp, alipay, swan, tt, qq, jd, rn
|
|
152
|
+
* @supported weapp, alipay, swan, tt, qq, jd, rn, harmony
|
|
153
153
|
* @see https://developers.weixin.qq.com/miniprogram/dev/component/camera.html
|
|
154
154
|
*/
|
|
155
155
|
declare const Camera: ComponentType<CameraProps>
|
package/types/Checkbox.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ interface CheckboxProps extends StandardProps {
|
|
|
43
43
|
|
|
44
44
|
/** 多选项目
|
|
45
45
|
* @classification forms
|
|
46
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
46
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
|
|
47
47
|
* @example_react
|
|
48
48
|
* ```tsx
|
|
49
49
|
* export default class PageCheckbox extends Component {
|
package/types/CheckboxGroup.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ interface CheckboxGroupProps extends StandardProps, FormItemProps {
|
|
|
16
16
|
|
|
17
17
|
/** 多项选择器,内部由多个checkbox组成
|
|
18
18
|
* @classification forms
|
|
19
|
-
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn
|
|
19
|
+
* @supported weapp, alipay, swan, tt, qq, jd, h5, rn, harmony
|
|
20
20
|
* @example
|
|
21
21
|
* ```tsx
|
|
22
22
|
* export default class PageCheckbox extends Component {
|
package/types/CoverImage.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ interface CoverImageProps extends StandardProps {
|
|
|
59
59
|
|
|
60
60
|
/** 覆盖在原生组件之上的图片视图。可覆盖的原生组件同cover-view,支持嵌套在cover-view里。
|
|
61
61
|
* @classification viewContainer
|
|
62
|
-
* @supported weapp, alipay, swan, qq, h5
|
|
62
|
+
* @supported weapp, alipay, swan, qq, h5, harmony
|
|
63
63
|
* @example_react
|
|
64
64
|
* ```tsx
|
|
65
65
|
* // js
|
package/types/CustomWrapper.d.ts
CHANGED