From 0728d005b79917c074195e68878f141801d17fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Tue, 24 May 2022 12:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(all):=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/dropdown/index.vue | 10 +- .../src/component/dropdownMenu/index.vue | 2 +- .../src/component/empty/interface.ts | 0 .../component/src/component/footer/index.ts | 2 +- .../src/component/formItem/index.vue | 4 +- .../src/component/fullscreen/index.ts | 2 +- .../component/src/component/header/index.ts | 2 +- .../component/src/component/header/index.vue | 2 +- .../component/src/component/icon/index.less | 0 .../src/component/iconPicker/index.less | 4 - .../src/component/iconPicker/index.ts | 2 +- .../src/component/iconPicker/index.vue | 68 +-- .../src/component/iconPicker/interface.ts | 0 .../component/src/component/input/index.less | 5 +- .../component/src/component/input/index.ts | 2 +- .../component/src/component/input/index.vue | 19 +- .../src/component/input/interface.ts | 0 .../src/component/inputNumber/index.vue | 2 +- .../src/component/inputNumber/interface.ts | 0 .../component/src/component/layout/index.vue | 2 +- package/component/tsconfig.json | 1 + package/document/src/components/LayCode.vue | 6 +- .../document/src/components/LayTableBox.vue | 1 + .../src/document/zh-CN/guide/changelog.md | 481 +----------------- 24 files changed, 77 insertions(+), 540 deletions(-) delete mode 100644 package/component/src/component/empty/interface.ts delete mode 100644 package/component/src/component/icon/index.less delete mode 100644 package/component/src/component/iconPicker/interface.ts delete mode 100644 package/component/src/component/input/interface.ts delete mode 100644 package/component/src/component/inputNumber/interface.ts diff --git a/package/component/src/component/dropdown/index.vue b/package/component/src/component/dropdown/index.vue index 520dbf2a..aecce7f6 100644 --- a/package/component/src/component/dropdown/index.vue +++ b/package/component/src/component/dropdown/index.vue @@ -19,18 +19,18 @@ const props = withDefaults(defineProps(), { trigger: "click", disabled: false, }); -const emit = defineEmits(["open", "hide"]); + const openState = ref(false); const dropdownRef = ref(null); const dropdownX = ref(0); const dropdownY = ref("auto"); - +const emit = defineEmits(["open", "hide"]); // @ts-ignore onClickOutside(dropdownRef, (event) => { openState.value = false; }); -const open = function (event?: Event) { +const open = function (event?: Event) : void { if (props.disabled === false) { if (event) { const el = event.currentTarget; @@ -47,12 +47,12 @@ const open = function (event?: Event) { } }; -const hide = function () { +const hide = function () : void { openState.value = false; emit("hide"); }; -const toggle = function (event?: Event) { +const toggle = function (event?: Event) : void { if (props.disabled === false) if (openState.value) { hide(); diff --git a/package/component/src/component/dropdownMenu/index.vue b/package/component/src/component/dropdownMenu/index.vue index 67601d81..86094114 100644 --- a/package/component/src/component/dropdownMenu/index.vue +++ b/package/component/src/component/dropdownMenu/index.vue @@ -8,4 +8,4 @@ export default { name: "LayDropdownMenu", }; - + \ No newline at end of file diff --git a/package/component/src/component/empty/interface.ts b/package/component/src/component/empty/interface.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/package/component/src/component/footer/index.ts b/package/component/src/component/footer/index.ts index bc751ebc..a1b16342 100644 --- a/package/component/src/component/footer/index.ts +++ b/package/component/src/component/footer/index.ts @@ -2,4 +2,4 @@ import { withInstall, WithInstallType } from "../../utils"; import Component from "./index.vue"; const component: WithInstallType = withInstall(Component); -export default component; +export default component; \ No newline at end of file diff --git a/package/component/src/component/formItem/index.vue b/package/component/src/component/formItem/index.vue index 37122fb1..f758b11e 100644 --- a/package/component/src/component/formItem/index.vue +++ b/package/component/src/component/formItem/index.vue @@ -24,9 +24,7 @@ import Schema, { Rule, RuleItem, Rules, - ValidateCallback, - ValidateError, - ValidateMessages, + ValidateCallback } from "async-validator"; import cnValidateMessage from "./cnValidateMessage"; diff --git a/package/component/src/component/fullscreen/index.ts b/package/component/src/component/fullscreen/index.ts index bc751ebc..a1b16342 100644 --- a/package/component/src/component/fullscreen/index.ts +++ b/package/component/src/component/fullscreen/index.ts @@ -2,4 +2,4 @@ import { withInstall, WithInstallType } from "../../utils"; import Component from "./index.vue"; const component: WithInstallType = withInstall(Component); -export default component; +export default component; \ No newline at end of file diff --git a/package/component/src/component/header/index.ts b/package/component/src/component/header/index.ts index bc751ebc..a1b16342 100644 --- a/package/component/src/component/header/index.ts +++ b/package/component/src/component/header/index.ts @@ -2,4 +2,4 @@ import { withInstall, WithInstallType } from "../../utils"; import Component from "./index.vue"; const component: WithInstallType = withInstall(Component); -export default component; +export default component; \ No newline at end of file diff --git a/package/component/src/component/header/index.vue b/package/component/src/component/header/index.vue index 79154577..9b88b5c7 100644 --- a/package/component/src/component/header/index.vue +++ b/package/component/src/component/header/index.vue @@ -12,4 +12,4 @@ import "./index.less";
- + \ No newline at end of file diff --git a/package/component/src/component/icon/index.less b/package/component/src/component/icon/index.less deleted file mode 100644 index e69de29b..00000000 diff --git a/package/component/src/component/iconPicker/index.less b/package/component/src/component/iconPicker/index.less index 4bbc7877..5e3f3695 100644 --- a/package/component/src/component/iconPicker/index.less +++ b/package/component/src/component/iconPicker/index.less @@ -59,10 +59,6 @@ transform: rotate(180deg); } -.layui-iconpicker-none { - color: rgba(0, 0, 0, 0.5); -} - .layui-iconpicker-search { padding: 10px; box-shadow: 0 2px 8px #f0f1f2; diff --git a/package/component/src/component/iconPicker/index.ts b/package/component/src/component/iconPicker/index.ts index bc751ebc..a1b16342 100644 --- a/package/component/src/component/iconPicker/index.ts +++ b/package/component/src/component/iconPicker/index.ts @@ -2,4 +2,4 @@ import { withInstall, WithInstallType } from "../../utils"; import Component from "./index.vue"; const component: WithInstallType = withInstall(Component); -export default component; +export default component; \ No newline at end of file diff --git a/package/component/src/component/iconPicker/index.vue b/package/component/src/component/iconPicker/index.vue index 3e7d9187..cc053fbb 100644 --- a/package/component/src/component/iconPicker/index.vue +++ b/package/component/src/component/iconPicker/index.vue @@ -9,6 +9,7 @@ import "./index.less"; import { Ref, ref } from "vue"; import { LayIconList as icons } from "@layui/icons-vue"; import LayDropdown from "../dropdown/index.vue"; +import layInput from "../input/index.vue"; export interface LayIconPickerProps { page?: boolean; @@ -21,21 +22,22 @@ const props = withDefaults(defineProps(), { page: false, }); -const emit = defineEmits(["update:modelValue"]); -const dropdownRef = ref(null); +const emit = defineEmits(["update:modelValue", "change"]); const selectedIcon: Ref = ref(props.modelValue as string); +const dropdownRef = ref(null); const selectIcon = function (icon: string) { emit("update:modelValue", icon); + emit("change", icon); selectedIcon.value = icon; - // @ts-ignore - dropdownRef.value.hide(); + dropdownRef.value?.hide(); }; const icones: Ref = ref([]); const total = ref(icons.length); const totalPage = ref(total.value / 12); const currentPage: Ref = ref(1); +const searchValue = ref(); if (props.page) { icones.value = icons.slice(0, 12); @@ -63,20 +65,24 @@ const prev = function () { icones.value = icons.slice(start, end); }; +const clear = () => { + const start = (currentPage.value - 1) * 12; + const end = start + 12; + if (props.page) { + icones.value = icons.slice(start, end); + total.value = icons.length; + totalPage.value = Math.ceil(icons.length / 12); + } else { + icones.value = icons; + } +}; + const search = function (e: any) { - var text = e.target.value; currentPage.value = 1; const start = (currentPage.value - 1) * 12; const end = start + 12; - if (text === "") { - if (props.page) { - icones.value = icons.slice(start, end); - total.value = icons.length; - totalPage.value = Math.ceil(icons.length / 12); - } else { - icones.value = icons; - } - } else { + const text = e.target.value; + if (text) { if (props.page) { icones.value = searchList(text, icons).slice(start, end); total.value = searchList(text, icons).length; @@ -84,6 +90,14 @@ const search = function (e: any) { } else { icones.value = searchList(text, icons); } + } else { + if (props.page) { + icones.value = icons.slice(start, end); + total.value = icons.length; + totalPage.value = Math.ceil(icons.length / 12); + } else { + icones.value = icons; + } } }; @@ -135,23 +149,17 @@ const searchList = function (str: string, container: any) { \ No newline at end of file diff --git a/package/component/src/component/input/interface.ts b/package/component/src/component/input/interface.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/package/component/src/component/inputNumber/index.vue b/package/component/src/component/inputNumber/index.vue index ff57c9e7..4357765b 100644 --- a/package/component/src/component/inputNumber/index.vue +++ b/package/component/src/component/inputNumber/index.vue @@ -33,8 +33,8 @@ const props = withDefaults(defineProps(), { }); const emit = defineEmits(["update:modelValue", "change"]); - let num = ref(props.modelValue); + watch(num, (val) => { if (props.max !== Infinity && val > props.max) { num.value = props.max; diff --git a/package/component/src/component/inputNumber/interface.ts b/package/component/src/component/inputNumber/interface.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/package/component/src/component/layout/index.vue b/package/component/src/component/layout/index.vue index c2f67490..a0afe227 100644 --- a/package/component/src/component/layout/index.vue +++ b/package/component/src/component/layout/index.vue @@ -38,4 +38,4 @@ const classes = computed(() => {
- + \ No newline at end of file diff --git a/package/component/tsconfig.json b/package/component/tsconfig.json index 45ba54b4..bd113d6b 100644 --- a/package/component/tsconfig.json +++ b/package/component/tsconfig.json @@ -11,6 +11,7 @@ "emitDeclarationOnly": true, "esModuleInterop": true, "declarationDir": "types", + "jsx": "preserve", "lib": ["ESNext","DOM"] }, "include": ["src/**/*","shims-vue.d.ts"], diff --git a/package/document/src/components/LayCode.vue b/package/document/src/components/LayCode.vue index 76e8d7fa..4c3fd5f3 100644 --- a/package/document/src/components/LayCode.vue +++ b/package/document/src/components/LayCode.vue @@ -66,8 +66,7 @@ const copy = function () { navigator.clipboard.writeText(text); successful = true; } else if (window.getSelection()) { - // 使用document.execCommand - // 代码div显示状态直接使用,隐藏状态则创建一个div + // 使用 document.execCommand var range = document.createRange(); let copyDiv; if (show.value) { @@ -103,8 +102,7 @@ onMounted(() => { const foundCodes = meta.value.getElementsByClassName("language-html"); if (foundDescs.length) { - codeAreaHeight.value = - foundDescs[0].clientHeight + foundCodes[0].clientHeight + 30; + codeAreaHeight.value = foundDescs[0].clientHeight + foundCodes[0].clientHeight + 30; } else { codeAreaHeight.value = foundCodes[0].clientHeight + 20; } diff --git a/package/document/src/components/LayTableBox.vue b/package/document/src/components/LayTableBox.vue index 4ad66671..4545a892 100644 --- a/package/document/src/components/LayTableBox.vue +++ b/package/document/src/components/LayTableBox.vue @@ -3,6 +3,7 @@ +