add alpha branch

This commit is contained in:
就眠儀式 2022-01-27 16:18:16 +08:00
parent 5c79b2b9ba
commit 5ea8b7bf7c
103 changed files with 577 additions and 474 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ node_modules/
dist/
example/dist/
lib/
es/
/types/
npm-debug.log*
yarn-debug.log*

40
build.all.ts Normal file
View File

@ -0,0 +1,40 @@
import { UserConfigExport } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
export default (): UserConfigExport => {
return {
publicDir: false,
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, './')
}
]
},
plugins: [
vue(),
],
build: {
cssCodeSplit: false,
outDir: 'lib',
emptyOutDir: true,
lib: {
entry: resolve(__dirname, './src/index.ts'),
name: 'layui-vue',
formats: ['es'],
fileName: (name) => `index.js`
},
rollupOptions: {
output: {
globals: {
vue: 'Vue'
},
assetFileNames: 'index.css',
},
external: ['vue', 'vue-router']
}
}
}
}

64
build.es.ts Normal file
View File

@ -0,0 +1,64 @@
import { UserConfigExport } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'
import * as fs from 'fs'
const inputDir = resolve(__dirname, './src/component')
const inputsArray = fs.readdirSync(inputDir).filter((name) => {
const componentDir = resolve(inputDir, name)
const isDir = fs.lstatSync(componentDir).isDirectory()
return isDir && fs.readdirSync(componentDir).includes('index.ts')
})
const inputs = inputsArray.reduce((backObj, pkgName) => {
backObj[pkgName] = resolve(__dirname, `./src/component/${pkgName}/index.ts`)
return backObj
}, {})
inputs['index'] = resolve(__dirname, './src/index.ts')
export default (): UserConfigExport => {
return {
publicDir: false,
resolve: {
alias: [
{
find: '@',
replacement: resolve(__dirname, './')
}
]
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
},
postcss: {}
},
plugins: [vue()],
build: {
cssCodeSplit: true,
emptyOutDir: true,
outDir: 'es',
lib: {
entry: './index.ts',
formats: ['es']
},
rollupOptions: {
input: inputs,
output: {
globals: {
vue: 'Vue'
},
entryFileNames: ({ name }) => {
return name === 'index' ? 'index.js' : '[name]/index.js'
},
assetFileNames: '[name]/index.css'
},
external: ['vue', 'vue-router']
}
}
}
}

View File

@ -17,7 +17,7 @@ export default {
setup() {
const openMsg = function() {
layer.msg("普通消息", { time: 1000 })
layer.msg("普通消息", { time: 100000 })
}
return {
openMsg
@ -48,7 +48,7 @@ export default {
setup() {
const openSuccess = function() {
layer.msg("成功消息", { icon : 1, time: 1000})
layer.msg("成功消息", { icon : 1, time: 100000})
}
const openFailure = function() {

View File

@ -5,8 +5,8 @@ import plugins from './src/plugin/common-plugins'
export default defineConfig({
resolve: {
alias: {
'/@src': path.resolve(__dirname, '../src'),
'/@src': path.resolve(__dirname, './src'),
},
},
plugins,
})
})

View File

@ -1,12 +1,11 @@
{
"name": "@layui/layui-vue",
"version": "0.3.5",
"author": "sleeprite",
"version": "0.3.6-alpha.2",
"author": "SleepRite",
"license": "MIT",
"description": "a component library for Vue 3 base on layui-vue",
"homepage": "http://layui-vue.pearadmin.com",
"module": "lib/layui-vue.es.js",
"main": "lib/layui-vue.umd.js",
"main": "es/index.js",
"types": "types/index.d.ts",
"style": "lib/index.css",
"keywords": [
@ -16,16 +15,16 @@
],
"exports": {
".": {
"import": "./lib/layui-vue.es.js",
"require": "./lib/layui-vue.umd.js"
"import": "./es/index.js"
},
"./lib/": "./lib/"
"./lib/": "./lib/",
"./es/": "./es/"
},
"scripts": {
"dev": "vite",
"build": "vite build --emptyOutDir && npm run build:types",
"build:es": "es use",
"build:umd": "umd use",
"serve": "vite example",
"build": "npm run build:all && npm run build:es && npm run build:types && npm run build:example",
"build:es": "vite build --emptyOutDir --config ./build.es.ts",
"build:all": "vite build --emptyOutDir --config ./build.all.ts",
"build:types": "rimraf types && tsc -d",
"build:example": "vite build example",
"lint:eslint": "eslint 'src/**/*.{vue,ts,tsx}' --fix",
@ -73,7 +72,7 @@
},
"files": [
"lib",
"src",
"es",
"types"
],
"browserslist": [

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayAvatar", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayAvatarList", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBacktop", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBadge", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBlock", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBody", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBreadcrumb", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,10 +1,10 @@
<template>
<span class="layui-breadcrumb" style="visibility: visible">
<slot></slot>
</span>
</template>
<script lang="ts">
export default {
name: "LayBreadcrumb",
};
</script>
<script setup name="LayBreadcrumb" lang="ts">
<script setup lang="ts">
import { defineProps, provide, withDefaults } from "vue";
const props = withDefaults(
@ -18,3 +18,9 @@ const props = withDefaults(
provide("separator", props.separator);
</script>
<template>
<span class="layui-breadcrumb" style="visibility: visible">
<slot></slot>
</span>
</template>

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayBreadcrumbItem", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayButton", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayButtonContainer", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayButtonGroup", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCard ", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCarousel", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCarouselItem", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCheckbox", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCheckboxGroup", Component);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCol", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCollapse", Component);

View File

@ -1,10 +1,9 @@
<template>
<div class="layui-collapse">
<slot></slot>
</div>
</template>
<script lang="ts">
export default {
name:"LayCollapse"
}
</script>
<script setup name="LayCollapse"></script>
<script setup lang="ts">
import {
withDefaults,
@ -43,3 +42,9 @@ provide("layCollapse", {
emit,
});
</script>
<template>
<div class="layui-collapse">
<slot></slot>
</div>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCollapseItem", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -15,7 +15,13 @@
</div>
</template>
<script setup name="LayCollapseItem" lang="ts">
<script lang="ts">
export default {
name:"LayCollapseItem"
}
</script>
<script setup lang="ts">
import { withDefaults, defineProps, inject, computed, ref } from "vue";
const props = withDefaults(

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayColorPicker", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayContainer", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayCountUp", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayDropdown", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayDropdownItem", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayEmpty", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayField", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayFooter", Component);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayForm", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,3 @@
<template>
<form class="layui-form" :onsubmit="submit">
<slot></slot>
</form>
</template>
<script lang="ts">
export default {
name: "LayForm",
@ -14,11 +8,10 @@ export default {
import { toRefs, provide, reactive, onMounted } from "vue";
import { Rule, ValidateError, ValidateMessages } from "async-validator";
import {
layFormKey,
LayFormItemContext,
FormCallback,
modelType,
} from "../type/form";
} from "../../types/form";
const props = withDefaults(
defineProps<{
@ -150,7 +143,7 @@ const addField = function (item: LayFormItemContext) {
defineExpose({ validate, clearValidate, reset });
provide(
layFormKey,
'LayForm',
reactive({
formItems,
addField,
@ -160,3 +153,9 @@ provide(
})
);
</script>
<template>
<form class="layui-form" :onsubmit="submit">
<slot></slot>
</form>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayFormItem", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,36 +1,10 @@
<template>
<div class="layui-form-item" ref="formItemRef">
<label class="layui-form-label">
<span
v-if="props.prop && isRequired"
:class="
['layui-required', 'layui-icon'].concat(layForm.requiredIcons ?? '')
"
>
<slot name="required" :props="{ ...props, model: layForm.model }">{{
layForm.requiredIcons ? "" : "*"
}}</slot>
</span>
<slot name="label" :props="{ ...props, model: layForm.model }">
{{ label }}
</slot>
</label>
<div :class="[mode ? 'layui-input-' + mode : '']">
<div ref="slotParent">
<slot :props="{ ...props, model: layForm.model }"></slot>
</div>
<span
v-if="errorStatus"
:class="[
'layui-error-message',
{ 'layui-error-message-anim': errorStatus },
]"
>{{ errorMsg }}</span
>
</div>
</div>
</template>
<script setup name="LayFormItem" lang="ts">
<script lang="ts">
export default {
name: 'LayFormItem'
}
</script>
<script setup lang="ts">
import "./index.less";
import {
defineProps,
@ -44,11 +18,10 @@ import {
watch,
} from "vue";
import {
layFormKey,
LayFormContext,
LayFormItemContext,
FieldValidateError,
} from "../type/form";
} from "../../types/form";
import Schema, {
Rule,
RuleItem,
@ -73,7 +46,7 @@ const props = withDefaults(
}
);
const layForm = inject(layFormKey, {} as LayFormContext);
const layForm = inject('LayForm', {} as LayFormContext);
const formItemRef = ref<HTMLDivElement>();
const slotParent = ref<HTMLDivElement>();
@ -192,3 +165,36 @@ onMounted(() => {
}
});
</script>
<template>
<div class="layui-form-item" ref="formItemRef">
<label class="layui-form-label">
<span
v-if="props.prop && isRequired"
:class="
['layui-required', 'layui-icon'].concat(layForm.requiredIcons ?? '')
"
>
<slot name="required" :props="{ ...props, model: layForm.model }">{{
layForm.requiredIcons ? "" : "*"
}}</slot>
</span>
<slot name="label" :props="{ ...props, model: layForm.model }">
{{ label }}
</slot>
</label>
<div :class="[mode ? 'layui-input-' + mode : '']">
<div ref="slotParent">
<slot :props="{ ...props, model: layForm.model }"></slot>
</div>
<span
v-if="errorStatus"
:class="[
'layui-error-message',
{ 'layui-error-message-anim': errorStatus },
]"
>{{ errorMsg }}</span
>
</div>
</div>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayHeader", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import { LayIcon as Component } from "@layui/icons-vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayIcon", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayIconPicker", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayInput", Component);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayInputNumber", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,45 +1,3 @@
<template>
<div class="layui-input-number" :position="position" :size="size">
<lay-button
type="primary"
size="gl"
@mousedown="longDown(subtraction)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"
:disabled="minControl"
class="layui-control-btn layui-subtraction-btn"
>
<lay-icon
:type="
position === 'right' ? 'layui-icon-down' : 'layui-icon-subtraction'
"
/>
</lay-button>
<div class="layui-input-number-input">
<lay-input
v-model="num"
:readonly="disabledInput || disabled"
type="number"
:name="name"
@change="inputChange"
/>
</div>
<lay-button
type="primary"
size="gl"
@mousedown="longDown(addition)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"
:disabled="maxControl"
class="layui-control-btn layui-addition-btn"
>
<lay-icon
:type="position === 'right' ? 'layui-icon-up' : 'layui-icon-addition'"
/>
</lay-button>
</div>
</template>
<script lang="ts">
export default {
name: "LayInputNumber",
@ -151,3 +109,45 @@ const isNumber = function (num: any) {
return /^\d+(\.\d+)?$/.test(num);
};
</script>
<template>
<div class="layui-input-number" :position="position" :size="size">
<lay-button
type="primary"
size="gl"
@mousedown="longDown(subtraction)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"
:disabled="minControl"
class="layui-control-btn layui-subtraction-btn"
>
<lay-icon
:type="
position === 'right' ? 'layui-icon-down' : 'layui-icon-subtraction'
"
/>
</lay-button>
<div class="layui-input-number-input">
<lay-input
v-model="num"
:readonly="disabledInput || disabled"
type="number"
:name="name"
@change="inputChange"
/>
</div>
<lay-button
type="primary"
size="gl"
@mousedown="longDown(addition)"
@mouseup="cancelLongDown"
@blur="cancelLongDown"
:disabled="maxControl"
class="layui-control-btn layui-addition-btn"
>
<lay-icon
:type="position === 'right' ? 'layui-icon-up' : 'layui-icon-addition'"
/>
</lay-button>
</div>
</template>

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import { LayLayer } from "@layui/layer-vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
LayLayer.install = (app: App) => {
app.component(LayLayer.name || "LayLayer", LayLayer);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayLayout", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayLine", Component);

View File

@ -2,7 +2,13 @@
<hr :class="['layui-border-' + theme]" />
</template>
<script setup name="LayLine" lang="ts">
<script lang="ts">
export default {
name: "LayLine"
}
</script>
<script setup lang="ts">
import { defineProps } from "vue";
const props = defineProps<{

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayLogo", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -4,4 +4,12 @@
</div>
</template>
<script setup name="LayLogo" lang="ts"></script>
<script lang="ts">
export default {
name: "LayLogo"
}
</script>
<script setup lang="ts">
import { defineProps } from "vue";
</script>

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayMenu", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayMenuItem", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayPage", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayPanel", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayProgress", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayRadio ", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayRate", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayRow", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayScroll", Component);

View File

@ -4,4 +4,12 @@
</div>
</template>
<script setup name="LayScroll" lang="ts"></script>
<script lang="ts">
export default {
name: "LayScroll"
}
</script>
<script setup lang="ts">
import { defineProps } from "vue";
</script>

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LaySelect", Component);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LaySelectOption", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -24,7 +24,7 @@ export default {
<script setup lang="ts">
import LayCheckbox from "../checkbox";
import { SelectItem, SelectItemHandle, SelectItemPush } from "../type";
import { SelectItem, SelectItemHandle, SelectItemPush } from "../../types";
import { computed, defineProps, inject, onMounted, Ref } from "vue";
const props = withDefaults(
@ -72,6 +72,7 @@ const callSelectItemPush = function () {
label: props.label,
disabled: props.disabled,
};
// @ts-ignore
selectItemPush(item);
};
onMounted(() => {

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LaySide", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,6 +1,6 @@
import type { App } from 'vue'
import Component from './index.vue'
import type { IDefineComponent } from '../type/index'
import type { IDefineComponent } from '../../types/index'
Component.install = (app: App) => {
app.component(Component.name || 'LaySkeleton', Component)

View File

@ -1,9 +1,8 @@
import type { App } from 'vue'
import Component from './index.vue'
import type { IDefineComponent } from '../type/index'
Component.install = (app: App) => {
app.component(Component.name || 'LaySkeletonItem', Component)
app.component(Component.name, Component)
}
export default Component as IDefineComponent
export default Component;

View File

@ -1,12 +1,10 @@
<template>
<div :class="['lay-skeleton-item',`lay-skeleton-type--${type}`]" v-bind="$attrs">
<div v-if="type==='image'" >
<lay-icon type="layui-icon-picture"></lay-icon>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "LaySkeletonItem"
}
</script>
<script setup name="LaySkeletonItem" lang="ts">
<script setup lang="ts">
import { defineProps, withDefaults} from "vue";
export interface LaySkeletonProps {
@ -16,4 +14,12 @@ export interface LaySkeletonProps {
const props = withDefaults(defineProps<LaySkeletonProps>(), {
type: 'p',
});
</script>-
</script>
<template>
<div :class="['lay-skeleton-item',`lay-skeleton-type--${type}`]" v-bind="$attrs">
<div v-if="type==='image'" >
<lay-icon type="layui-icon-picture"></lay-icon>
</div>
</div>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LaySlider", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,105 +1,9 @@
<template>
<div class="layui-slider-vertical" v-if="vertical">
<div
ref="rangetracker2"
@mousedown.stop="handle_mousedown"
class="layui-slider-vrange"
v-if="range"
>
<div
:style="{ bottom: verticalRangeValue[1] + '%' }"
class="layui-slider-vertical-btn"
></div>
<div
:style="{ bottom: verticalRangeValue[0] + '%' }"
class="layui-slider-vertical-btn"
></div>
<div class="layui-slider-vertical-line"></div>
<div
:style="{
height: verticalRangeValue[1] - verticalRangeValue[0] + '%',
bottom: verticalRangeValue[0] + '%',
}"
class="layui-slider-vertical-rate"
></div>
</div>
<script lang="ts">
export default {
name: "LaySlider"
}
</script>
<div
ref="verticaltracker"
@mousedown.stop="handle_mousedown"
class="layui-slider-vertical-track"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
v-else
>
<lay-tooltip :content="modelValue + ''">
<div
:style="{ bottom: modelValue + '%' }"
class="layui-slider-vertical-btn"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
></div>
</lay-tooltip>
<div
:style="{ height: modelValue + '%' }"
class="layui-slider-vertical-rate"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-vertical-line"></div>
</div>
</div>
<div class="layui-slider-v" v-else>
<div
@mousedown.stop="handle_mousedown"
ref="rangetracker1"
class="layui-slider-srange"
v-if="range"
>
<lay-tooltip :content="rangeValue[0] + ''">
<div
:style="{ left: rangeValue[0] + '%' }"
class="layui-slider-btn-v"
></div>
</lay-tooltip>
<lay-tooltip :content="rangeValue[1]">
<div
:style="{ left: rangeValue[1] + '%' }"
class="layui-slider-btn-v"
></div>
</lay-tooltip>
<div class="layui-slider-line-v"></div>
<div
:style="{
width: rangeValue[1] - rangeValue[0] + '%',
left: rangeValue[0] + '%',
}"
class="layui-slider-rate-v"
></div>
</div>
<div
ref="standardtracker"
@mousedown.stop="handle_mousedown"
class="layui-slider-track-v"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
v-else
>
<lay-tooltip :content="modelValue + ''">
<div
:style="{ left: modelValue + '%' }"
class="layui-slider-btn-v"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
></div>
</lay-tooltip>
<div
:style="{ width: modelValue + '%' }"
class="layui-slider-rate-v"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-line-v"></div>
</div>
</div>
</template>
<script setup lang="ts">
import { defineProps, reactive, Ref, ref, toRef } from "vue";
import { on, off } from "evtd";
@ -303,3 +207,106 @@ function moveNeighbors(rate: number, rangeValues: any) {
}
}
</script>
<template>
<div class="layui-slider-vertical" v-if="vertical">
<div
ref="rangetracker2"
@mousedown.stop="handle_mousedown"
class="layui-slider-vrange"
v-if="range"
>
<div
:style="{ bottom: verticalRangeValue[1] + '%' }"
class="layui-slider-vertical-btn"
></div>
<div
:style="{ bottom: verticalRangeValue[0] + '%' }"
class="layui-slider-vertical-btn"
></div>
<div class="layui-slider-vertical-line"></div>
<div
:style="{
height: verticalRangeValue[1] - verticalRangeValue[0] + '%',
bottom: verticalRangeValue[0] + '%',
}"
class="layui-slider-vertical-rate"
></div>
</div>
<div
ref="verticaltracker"
@mousedown.stop="handle_mousedown"
class="layui-slider-vertical-track"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
v-else
>
<lay-tooltip :content="modelValue + ''">
<div
:style="{ bottom: modelValue + '%' }"
class="layui-slider-vertical-btn"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
></div>
</lay-tooltip>
<div
:style="{ height: modelValue + '%' }"
class="layui-slider-vertical-rate"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-vertical-line"></div>
</div>
</div>
<div class="layui-slider-v" v-else>
<div
@mousedown.stop="handle_mousedown"
ref="rangetracker1"
class="layui-slider-srange"
v-if="range"
>
<lay-tooltip :content="rangeValue[0] + ''">
<div
:style="{ left: rangeValue[0] + '%' }"
class="layui-slider-btn-v"
></div>
</lay-tooltip>
<lay-tooltip :content="rangeValue[1]">
<div
:style="{ left: rangeValue[1] + '%' }"
class="layui-slider-btn-v"
></div>
</lay-tooltip>
<div class="layui-slider-line-v"></div>
<div
:style="{
width: rangeValue[1] - rangeValue[0] + '%',
left: rangeValue[0] + '%',
}"
class="layui-slider-rate-v"
></div>
</div>
<div
ref="standardtracker"
@mousedown.stop="handle_mousedown"
class="layui-slider-track-v"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
v-else
>
<lay-tooltip :content="modelValue + ''">
<div
:style="{ left: modelValue + '%' }"
class="layui-slider-btn-v"
:class="[props.disabled ? 'layui-slider-disabled' : '']"
></div>
</lay-tooltip>
<div
:style="{ width: modelValue + '%' }"
class="layui-slider-rate-v"
:class="[props.disabled ? 'layui-slider-disabled-rate' : '']"
></div>
<div class="layui-slider-line-v"></div>
</div>
</div>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "laySplitPanel", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -11,7 +11,13 @@
</div>
</template>
<script setup name="laySplitPanel" lang="ts">
<script lang="ts">
export default {
name: "laySplitPanel"
}
</script>
<script setup lang="ts">
import { ref, watch, provide, defineProps, withDefaults, onMounted } from "vue";
import "./index.less";

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "laySplitPanelItem", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -21,7 +21,13 @@
</div>
</template>
<script setup name="laySplitPanelItem" lang="ts">
<script lang="ts">
export default {
name: "LaySplitPanelItem"
}
</script>
<script setup lang="ts">
import {
ref,
inject,

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "laySetup", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,10 +1,10 @@
<template>
<div :class="['lay-step', direction !== 'vertical' ? '' : 'lay-step-column']">
<slot></slot>
</div>
</template>
<script lang="ts">
export default {
name: "LayStep"
}
</script>
<script setup name="layStep" lang="ts">
<script setup lang="ts">
import {
ref,
watch,
@ -39,7 +39,7 @@ const steps = ref([]);
const emits = defineEmits(["onChange"]);
const change = (index) => {
const change = (index: any) => {
emits("onChange", index - 1);
};
@ -58,4 +58,8 @@ provide("LayStep", {
});
</script>
<style scoped></style>
<template>
<div :class="['lay-step', direction !== 'vertical' ? '' : 'lay-step-column']">
<slot></slot>
</div>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "laySetupItem", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -81,7 +81,13 @@
</div>
</template>
<script setup name="LayStepItem" lang="ts">
<script lang="ts">
export default {
name: "LayStepItem"
}
</script>
<script setup lang="ts">
import {
ref,
inject,
@ -117,7 +123,7 @@ const setIndex = (val: number) => {
index.value = val;
};
const onChange = (index) => {
const onChange = (index: any) => {
parents.change(index);
};

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "laySubMenu", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LaySwitch", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTab", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,30 +1,3 @@
<template>
<div
class="layui-tab"
:class="[type ? 'layui-tab-' + type : '']"
v-if="active"
>
<ul class="layui-tab-title">
<li
v-for="(children, index) in childrens"
:key="children"
:class="[children.props.id === active ? 'layui-this' : '']"
@click.stop="change(children.props.id)"
>
{{ children.props.title }}
<i
v-if="allowClose && children.props.closable != false"
class="layui-icon layui-icon-close layui-unselect layui-tab-close"
@click.stop="close(index, children.props.id)"
></i>
</li>
</ul>
<div class="layui-tab-content">
<slot></slot>
</div>
</div>
</template>
<script lang="ts">
export default {
name: "LayTab",
@ -114,3 +87,30 @@ watch(slotsChange, function () {
provide("active", active);
provide("slotsChange", slotsChange);
</script>
<template>
<div
class="layui-tab"
:class="[type ? 'layui-tab-' + type : '']"
v-if="active"
>
<ul class="layui-tab-title">
<li
v-for="(children, index) in childrens"
:key="children"
:class="[children.props.id === active ? 'layui-this' : '']"
@click.stop="change(children.props.id)"
>
{{ children.props.title }}
<i
v-if="allowClose && children.props.closable != false"
class="layui-icon layui-icon-close layui-unselect layui-tab-close"
@click.stop="close(index, children.props.id)"
></i>
</li>
</ul>
<div class="layui-tab-content">
<slot></slot>
</div>
</div>
</template>

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTabItem", Component);

View File

@ -1,16 +1,10 @@
<template>
<div class="layui-tab-item" :class="[active === id ? 'layui-show' : '']">
<slot></slot>
</div>
</template>
<script lang="ts">
export default {
name: "LayTabItem",
};
</script>
<script setup name="LayTabItem" lang="ts">
<script setup lang="ts">
import { withDefaults, defineProps, inject, Ref } from "vue";
const props = withDefaults(
@ -28,3 +22,9 @@ const active = inject("active");
const slotsChange: Ref<boolean> = inject("slotsChange") as Ref<boolean>;
slotsChange.value = !slotsChange.value;
</script>
<template>
<div class="layui-tab-item" :class="[active === id ? 'layui-show' : '']">
<slot></slot>
</div>
</template>

View File

@ -0,0 +1,6 @@
.laytable-cell-checkbox {
width: 34px;
}
.layui-table-col-special {
width: 34px;
}

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTable", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -13,8 +13,9 @@ import {
withDefaults,
defineEmits,
} from "vue";
import { Recordable } from "../type";
import { Recordable } from "../../types";
import { guid } from "../../utils/guidUtil";
import "./index.less";
const tableId = guid();
@ -241,13 +242,4 @@ const print = function () {
</div>
</div>
</div>
</template>
<style scoped>
.laytable-cell-checkbox {
width: 34px;
}
.layui-table-col-special {
width: 34px;
}
</style>
</template>

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTextarea", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTimeline", Component);

View File

@ -1,6 +1,6 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
import type { IDefineComponent } from "../../types/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTimelineItem", Component);

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTooltip", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -2,6 +2,7 @@
<slot></slot>
<lay-popper v-if="isMounted" v-bind="innerProps"></lay-popper>
</template>
<script lang="ts">
import LayPopper from "../popper/index.vue";
import { defineComponent, ref } from "vue";

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTransfer", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -3,10 +3,11 @@ export default {
name: "LayTransfer",
};
</script>
<script setup lang="ts">
import "./index.less";
import { defineProps, Ref, ref, useSlots, watch } from "vue";
import { Recordable } from "../type";
import { Recordable } from "../../types";
const slot = useSlots();

View File

@ -1,9 +1,8 @@
import type { App } from "vue";
import Component from "./index.vue";
import type { IDefineComponent } from "../type/index";
Component.install = (app: App) => {
app.component(Component.name || "LayTree", Component);
app.component(Component.name, Component);
};
export default Component as IDefineComponent;
export default Component;

View File

@ -1,5 +1,5 @@
import { OriginalTreeData, StringOrNumber } from "./tree.type";
import { Nullable } from "../type";
import { Nullable } from "../../types";
import { Ref, ref } from "vue";
type CustomKey = string | number;

View File

@ -1,5 +1,4 @@
import type { App } from "vue";
import type { IDefineComponent, InstallOptions } from "./component/type/index";
import type { App, Component } from "vue";
import "./theme/index.less";
import "@layui/layer-vue/lib/index.css";
@ -75,7 +74,7 @@ import LaySubMenu from "./component/subMenu/index";
import LaySplitPanel from "./component/splitPanel/index";
import LaySplitPanelItem from "./component/splitPanelItem/index";
const components: Record<string, IDefineComponent> = {
const components: Record<string, Component> = {
LaySplitPanel,
LaySplitPanelItem,
LayRadio,
@ -146,9 +145,7 @@ const components: Record<string, IDefineComponent> = {
LaySubMenu,
};
const install = (app: App, options?: InstallOptions): void => {
const _options = options;
app.config.globalProperties.$PROOPTIONS = _options;
const install = (app: App): void => {
for (const key in components) {
const item = components[key];
app.component(item.name || key, item);

View File

@ -4,8 +4,6 @@ import type {
ValidateMessages,
} from "async-validator";
export const layFormKey = "LayForm";
export interface LayFormContext {
model: modelType;
required?: boolean;
@ -34,4 +32,4 @@ export declare interface FormCallback {
export declare interface FieldValidateError extends ValidateError {
label?: string;
}
}

Some files were not shown because too many files have changed in this diff Show More