fix(tinyvue): 同步内部代码,并修改grid组件再vue2下报错问题 (#254)

This commit is contained in:
ajaxzheng 2023-05-28 18:25:32 -07:00 committed by GitHub
parent 8cf6d4adaa
commit ee759b2a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 23 additions and 17 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@opentiny/vue-renderless", "name": "@opentiny/vue-renderless",
"private": true, "private": true,
"version": "3.8.5", "version": "3.8.2",
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.", "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
"homepage": "https://opentiny.design/tiny-vue", "homepage": "https://opentiny.design/tiny-vue",
"keywords": [ "keywords": [

View File

@ -10,11 +10,11 @@
* *
*/ */
import { handleClick } from './index' import { handleClick, moreNodeClick } from './index'
export const api = ['state', 'handleClick', 'moreNodeClick'] export const api = ['state', 'handleClick', 'moreNodeClick']
export const renderless = (props, { computed, reactive, watch, inject }, { emit, parent }) => { export function renderless(props, { computed, reactive, watch, inject }, { emit, parent }) {
parent.tinyForm = parent.tinyForm || inject('form', null) parent.tinyForm = parent.tinyForm || inject('form', null)
const state = reactive({ const state = reactive({
@ -44,7 +44,8 @@ export const renderless = (props, { computed, reactive, watch, inject }, { emit,
const api = { const api = {
state, state,
handleClick: handleClick({ emit, props, state }) handleClick: handleClick({ emit, props, state }),
moreNodeClick: moreNodeClick({ emit, props, state }),
} }
return api return api

View File

@ -0,0 +1,5 @@
export const api = []
export function renderless() {
const api = {}
return api
}

View File

@ -1,6 +1,6 @@
{ {
"name": "@opentiny/vue-theme-mobile", "name": "@opentiny/vue-theme-mobile",
"version": "3.8.5", "version": "3.8.2",
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.", "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
"homepage": "https://opentiny.design/tiny-vue", "homepage": "https://opentiny.design/tiny-vue",
"main": "index.css", "main": "index.css",

View File

@ -1,6 +1,6 @@
{ {
"name": "@opentiny/vue-theme", "name": "@opentiny/vue-theme",
"version": "3.8.0", "version": "3.8.2",
"description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.", "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
"main": "index.css", "main": "index.css",
"homepage": "https://opentiny.design/tiny-vue", "homepage": "https://opentiny.design/tiny-vue",

View File

@ -274,7 +274,7 @@ export default {
}, },
render() { render() {
let { editConfig, fetchOption, listeners, loading, optimization, pager, pagerConfig, remoteFilter, remoteSort, selectToolbar } = this as any let { editConfig, fetchOption, listeners, loading, optimization, pager, pagerConfig, remoteFilter, remoteSort, selectToolbar } = this as any
let { seqIndex, $slots, tableCustoms, tableData, tableListeners, tableLoading, tableProps, toolbar, vSize, designConfig } = this as any let { seqIndex, slots: $slots, tableCustoms, tableData, tableListeners, tableLoading, tableProps, toolbar, vSize, designConfig } = this as any
// grid全局替换smb图标 // grid全局替换smb图标
if (designConfig && designConfig.icons) { if (designConfig && designConfig.icons) {

View File

@ -14,8 +14,7 @@
}, },
"dependencies": { "dependencies": {
"@opentiny/vue-renderless": "workspace:~", "@opentiny/vue-renderless": "workspace:~",
"@opentiny/vue-common": "workspace:~", "@opentiny/vue-common": "workspace:~"
"@opentiny/vue-icon": "workspace:~"
}, },
"license": "MIT" "license": "MIT"
} }

View File

@ -28,7 +28,7 @@
> >
<span v-if="state.select.multiple && !state.select.state.multipleLimit"> <span v-if="state.select.multiple && !state.select.state.multipleLimit">
<tiny-checkbox <tiny-checkbox
v-model="state.itemSelected" :model-value="state.itemSelected"
:disabled="disabled || state.groupDisabled || state.limitReached" :disabled="disabled || state.groupDisabled || state.limitReached"
></tiny-checkbox> ></tiny-checkbox>
</span> </span>
@ -42,14 +42,11 @@
import { renderless, api } from '@opentiny/vue-renderless/option/vue' import { renderless, api } from '@opentiny/vue-renderless/option/vue'
import { $prefix, setup, defineComponent } from '@opentiny/vue-common' import { $prefix, setup, defineComponent } from '@opentiny/vue-common'
import Checkbox from '@opentiny/vue-checkbox' import Checkbox from '@opentiny/vue-checkbox'
import { iconCheck, iconCheckedSur } from '@opentiny/vue-icon'
export default defineComponent({ export default defineComponent({
name: $prefix + 'Option', name: $prefix + 'Option',
componentName: 'Option', componentName: 'Option',
components: { components: {
IconCheck: iconCheck(),
IconCheckedSur: iconCheckedSur(),
TinyCheckbox: Checkbox TinyCheckbox: Checkbox
}, },
props: { props: {

View File

@ -13,7 +13,8 @@
import Pager from '@opentiny/vue-pager-item' import Pager from '@opentiny/vue-pager-item'
import Popover from '@opentiny/vue-popover' import Popover from '@opentiny/vue-popover'
import { t } from '@opentiny/vue-locale' import { t } from '@opentiny/vue-locale'
import { $prefix, h, defineComponent } from '@opentiny/vue-common' import { $prefix, h, setup, defineComponent } from '@opentiny/vue-common'
import { renderless, api } from '@opentiny/vue-renderless/pager/vue'
import { import {
iconTriangleDown, iconTriangleDown,
iconChevronLeft, iconChevronLeft,
@ -80,6 +81,9 @@ export default defineComponent({
internalTotal: this.total internalTotal: this.total
} }
}, },
setup(props, context) {
return setup({ props, context, renderless, api })
},
render() { render() {
const layout = this.internalLayout const layout = this.internalLayout
@ -117,7 +121,7 @@ export default defineComponent({
pageSizes={this.pageSizes} pageSizes={this.pageSizes}
></sizes> ></sizes>
), ),
slot: <slot>{typeof this.$slots.default === 'function' ? this.$slots.default() : this.$slots.default}</slot>, slot: <slot>{this.slots.default && this.slots.default()}</slot>,
total: <total></total> total: <total></total>
} }
@ -211,7 +215,7 @@ export default defineComponent({
<div slot="reference" class="tiny-pager__popover"> <div slot="reference" class="tiny-pager__popover">
<div class="tiny-pager__input"> <div class="tiny-pager__input">
<input disabled={this.$parent.disabled} type="text" readonly="readonly" value={this.$parent.internalPageSize} /> <input disabled={this.$parent.disabled} type="text" readonly="readonly" value={this.$parent.internalPageSize} />
<div class="tiny-pager__input-btn"><TriangleDown class={['tiny-svg-size', this.showSizes? 'tiny-svg-size__reverse-180': '']} /></div> <div class="tiny-pager__input-btn"><TriangleDown class={['tiny-svg-size', this.showSizes ? 'tiny-svg-size__reverse-180' : '']} /></div>
</div> </div>
</div> </div>
), ),

View File

@ -262,7 +262,7 @@
@mousedown.stop @mousedown.stop
@mouseenter="state.hoverIndex = -9" @mouseenter="state.hoverIndex = -9"
> >
<tiny-checkbox v-model="state.isSelectAll" :indeterminate="state.isHalfSelect" :class="state.selectCls"> <tiny-checkbox :model-value="state.isSelectAll" :indeterminate="state.isHalfSelect" :class="state.selectCls">
{{ t('ui.base.all') }} {{ t('ui.base.all') }}
</tiny-checkbox> </tiny-checkbox>
</li> </li>