solely 0.4.10 → 0.4.12
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/README.md +35 -0
- package/dist/components/commands/modal/index.cjs +1 -1
- package/dist/components/commands/modal/index.js +1 -1
- package/dist/components/commands/tooltip/index.cjs +1 -1
- package/dist/components/commands/tooltip/index.js +1 -1
- package/dist/components/commands/tooltip/style.css.cjs +1 -1
- package/dist/components/commands/tooltip/style.css.js +1 -1
- package/dist/components/commands/tooltip/types.d.ts +2 -0
- package/dist/components/elements/alert/index.html.cjs +1 -1
- package/dist/components/elements/alert/index.html.js +1 -1
- package/dist/components/elements/backtop/index.cjs +1 -1
- package/dist/components/elements/backtop/index.d.ts +10 -0
- package/dist/components/elements/backtop/index.html.cjs +1 -1
- package/dist/components/elements/backtop/index.html.js +1 -1
- package/dist/components/elements/backtop/index.js +1 -1
- package/dist/components/elements/badge/index.html.cjs +1 -1
- package/dist/components/elements/badge/index.html.js +1 -1
- package/dist/components/elements/breadcrumb/index.html.cjs +1 -1
- package/dist/components/elements/breadcrumb/index.html.js +1 -1
- package/dist/components/elements/button/index.html.cjs +1 -1
- package/dist/components/elements/button/index.html.js +1 -1
- package/dist/components/elements/button/style.css.cjs +1 -1
- package/dist/components/elements/button/style.css.js +1 -1
- package/dist/components/elements/card/index.html.cjs +1 -1
- package/dist/components/elements/card/index.html.js +1 -1
- package/dist/components/elements/checkbox/index.html.cjs +1 -1
- package/dist/components/elements/checkbox/index.html.js +1 -1
- package/dist/components/elements/coordinate-input/index.html.cjs +1 -1
- package/dist/components/elements/coordinate-input/index.html.js +1 -1
- package/dist/components/elements/divider/index.html.cjs +1 -1
- package/dist/components/elements/divider/index.html.js +1 -1
- package/dist/components/elements/empty/index.html.cjs +1 -1
- package/dist/components/elements/empty/index.html.js +1 -1
- package/dist/components/elements/fab/index.html.cjs +1 -1
- package/dist/components/elements/fab/index.html.js +1 -1
- package/dist/components/elements/icon/index.html.cjs +1 -1
- package/dist/components/elements/icon/index.html.js +1 -1
- package/dist/components/elements/input/index.html.cjs +1 -1
- package/dist/components/elements/input/index.html.js +1 -1
- package/dist/components/elements/not-found/index.html.cjs +1 -1
- package/dist/components/elements/not-found/index.html.js +1 -1
- package/dist/components/elements/pagination/index.cjs +1 -1
- package/dist/components/elements/pagination/index.html.cjs +1 -1
- package/dist/components/elements/pagination/index.html.js +1 -1
- package/dist/components/elements/pagination/index.js +1 -1
- package/dist/components/elements/progress/index.html.cjs +1 -1
- package/dist/components/elements/progress/index.html.js +1 -1
- package/dist/components/elements/radio/index.html.cjs +1 -1
- package/dist/components/elements/radio/index.html.js +1 -1
- package/dist/components/elements/rate/index.html.cjs +1 -1
- package/dist/components/elements/rate/index.html.js +1 -1
- package/dist/components/elements/select/index.html.cjs +1 -1
- package/dist/components/elements/select/index.html.js +1 -1
- package/dist/components/elements/skeleton/index.html.cjs +1 -1
- package/dist/components/elements/skeleton/index.html.js +1 -1
- package/dist/components/elements/slider/index.html.cjs +1 -1
- package/dist/components/elements/slider/index.html.js +1 -1
- package/dist/components/elements/steps/index.d.ts +3 -12
- package/dist/components/elements/steps/index.html.cjs +1 -1
- package/dist/components/elements/steps/index.html.js +1 -1
- package/dist/components/elements/steps/types.d.ts +13 -0
- package/dist/components/elements/switch/index.html.cjs +1 -1
- package/dist/components/elements/switch/index.html.js +1 -1
- package/dist/components/elements/table/index.html.cjs +1 -1
- package/dist/components/elements/table/index.html.js +1 -1
- package/dist/components/elements/tabs/index.html.cjs +1 -1
- package/dist/components/elements/tabs/index.html.js +1 -1
- package/dist/components/elements/tabs/types.d.ts +10 -0
- package/dist/components/elements/tag/index.html.cjs +1 -1
- package/dist/components/elements/tag/index.html.js +1 -1
- package/dist/components/elements/timeline/index.html.cjs +1 -1
- package/dist/components/elements/timeline/index.html.js +1 -1
- package/dist/components/elements/tooltip/index.d.ts +59 -0
- package/dist/components/elements/tooltip/types.d.ts +23 -0
- package/dist/components/elements/tree/index.html.cjs +1 -1
- package/dist/components/elements/tree/index.html.js +1 -1
- package/dist/components/elements/tree/types.d.ts +17 -0
- package/dist/components/elements/upload/index.cjs +1 -1
- package/dist/components/elements/upload/index.d.ts +1 -0
- package/dist/components/elements/upload/index.html.cjs +1 -1
- package/dist/components/elements/upload/index.html.js +1 -1
- package/dist/components/elements/upload/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="steps" :class="this.getStepsClasses()">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="this.getParsedItems()" item="item" index="index">\n <div
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div part="base" class="steps" :class="this.getStepsClasses()" role="list" aria-label="步骤条">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="this.getParsedItems()" item="item" index="index">\n <div\n part="step"\n class="step"\n :class="this.getStepClasses(item, index)"\n role="listitem"\n :aria-current="this.getStepStatus(index) === \'process\' ? \'step\' : undefined"\n :aria-disabled="item.disabled ? \'true\' : \'false\'"\n @click="this.handleStepClick(item, index)"\n >\n <div part="tail" class="step__tail"></div>\n <div part="wrapper" class="step__wrapper">\n <div part="icon-wrapper" class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div part="icon" class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span part="icon-substitution" class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span part="icon-text" class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div part="content" class="step__content">\n <div part="title" class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div part="description" class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div\n part="step"\n class="step"\n :class="this.getSlotStepClasses(slotItem, index)"\n role="listitem"\n :aria-current="this.getSlotStepStatus(index) === \'process\' ? \'step\' : undefined"\n :aria-disabled="slotItem.disabled ? \'true\' : \'false\'"\n @click="this.handleSlotStepClick(slotItem, index)"\n >\n <div part="tail" class="step__tail"></div>\n <div part="wrapper" class="step__wrapper">\n <div part="icon-wrapper" class="step__icon-wrapper">\n <div part="icon" class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span part="icon-substitution" class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div part="content" class="step__content">\n <div part="title" class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div part="description" class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t='<div part="base" class="steps" :class="this.getStepsClasses()" role="list" aria-label="步骤条">\n \x3c!-- 使用 items 属性时的渲染 --\x3e\n <If test="!$data.useSlot">\n <For each="this.getParsedItems()" item="item" index="index">\n <div\n part="step"\n class="step"\n :class="this.getStepClasses(item, index)"\n role="listitem"\n :aria-current="this.getStepStatus(index) === \'process\' ? \'step\' : undefined"\n :aria-disabled="item.disabled ? \'true\' : \'false\'"\n @click="this.handleStepClick(item, index)"\n >\n <div part="tail" class="step__tail"></div>\n <div part="wrapper" class="step__wrapper">\n <div part="icon-wrapper" class="step__icon-wrapper" :class="this.getIconClasses(item)"\n :style="item.icon ? this.getIconStyle(item) : \'\'">\n <div part="icon" class="step__icon">\n <If test="!$data.progressDot">\n <If\n test="item.icon || this.getStepStatus(index) === \'finish\' || this.getStepStatus(index) === \'error\'">\n <span part="icon-substitution" class="step__icon-substitution">{{this.getStepIcon(item, index)}}</span>\n </If>\n <Else>\n <span part="icon-text" class="step__icon-text">{{index + 1}}</span>\n </Else>\n </If>\n </div>\n </div>\n <div part="content" class="step__content">\n <div part="title" class="step__title">{{item.title}}</div>\n <If test="item.description">\n <div part="description" class="step__description">{{item.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n\n \x3c!-- 使用插槽时的渲染 --\x3e\n <If test="$data.useSlot">\n <For each="$data.slotItems" item="slotItem" index="index">\n <div\n part="step"\n class="step"\n :class="this.getSlotStepClasses(slotItem, index)"\n role="listitem"\n :aria-current="this.getSlotStepStatus(index) === \'process\' ? \'step\' : undefined"\n :aria-disabled="slotItem.disabled ? \'true\' : \'false\'"\n @click="this.handleSlotStepClick(slotItem, index)"\n >\n <div part="tail" class="step__tail"></div>\n <div part="wrapper" class="step__wrapper">\n <div part="icon-wrapper" class="step__icon-wrapper">\n <div part="icon" class="step__icon">\n <If test="!$data.progressDot">\n \x3c!-- 使用插槽元素的 innerHTML 作为图标内容 --\x3e\n <span part="icon-substitution" class="step__icon-substitution" :innerHTML="slotItem.iconHtml"></span>\n </If>\n </div>\n </div>\n <div part="content" class="step__content">\n <div part="title" class="step__title">{{slotItem.title}}</div>\n <If test="slotItem.description">\n <div part="description" class="step__description">{{slotItem.description}}</div>\n </If>\n </div>\n </div>\n </div>\n </For>\n </If>\n</div>\n';export{t as default};
|
|
@@ -16,3 +16,16 @@ export interface StepsProps {
|
|
|
16
16
|
items: string;
|
|
17
17
|
progressDot: boolean;
|
|
18
18
|
}
|
|
19
|
+
/** 步骤项(插槽模式,从 Light DOM 收集) */
|
|
20
|
+
export interface StepsSlotItem {
|
|
21
|
+
step: string;
|
|
22
|
+
title: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
iconHtml: string;
|
|
26
|
+
}
|
|
27
|
+
/** change 事件 detail */
|
|
28
|
+
export interface StepsChangeEventDetail {
|
|
29
|
+
index: number;
|
|
30
|
+
item: StepItem | StepsSlotItem;
|
|
31
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="switch"\n :class="this.getSwitchClasses()"\n @click="this.handleClick()"\n tabindex="0"\n @keydown="this.handleKeyDown(event)"\n role="switch"\n :aria-checked="$data.checked ? \'true\' : \'false\'"\n :aria-disabled="$data.disabled ? \'true\' : \'false\'"\n>\n <div class="switch__track">\n <div class="switch__inner">\n <If test="this.hasCheckedSlot()">\n <span class="switch__inner-checked">\n <slot name="checked"></slot>\n </span>\n </If>\n <ElseIf test="$data.checkedChildren">\n <span class="switch__inner-checked">{{$data.checkedChildren}}</span>\n </ElseIf>\n <If test="this.hasUncheckedSlot()">\n <span class="switch__inner-unchecked">\n <slot name="unchecked"></slot>\n </span>\n </If>\n <ElseIf test="$data.unCheckedChildren">\n <span class="switch__inner-unchecked">{{$data.unCheckedChildren}}</span>\n </ElseIf>\n </div>\n <div class="switch__handle">\n <If test="$data.loading">\n <span class="switch__loading-icon"></span>\n </If>\n </div>\n </div>\n</div>\n';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n part="base"\n class="switch"\n :class="this.getSwitchClasses()"\n @click="this.handleClick()"\n tabindex="0"\n @keydown="this.handleKeyDown(event)"\n role="switch"\n :aria-checked="$data.checked ? \'true\' : \'false\'"\n :aria-disabled="$data.disabled ? \'true\' : \'false\'"\n>\n <div part="track" class="switch__track">\n <div part="inner" class="switch__inner">\n <If test="this.hasCheckedSlot()">\n <span part="checked-text" class="switch__inner-checked">\n <slot name="checked"></slot>\n </span>\n </If>\n <ElseIf test="$data.checkedChildren">\n <span part="checked-text" class="switch__inner-checked">{{$data.checkedChildren}}</span>\n </ElseIf>\n <If test="this.hasUncheckedSlot()">\n <span part="unchecked-text" class="switch__inner-unchecked">\n <slot name="unchecked"></slot>\n </span>\n </If>\n <ElseIf test="$data.unCheckedChildren">\n <span part="unchecked-text" class="switch__inner-unchecked">{{$data.unCheckedChildren}}</span>\n </ElseIf>\n </div>\n <div part="handle" class="switch__handle">\n <If test="$data.loading">\n <span part="loading-icon" class="switch__loading-icon"></span>\n </If>\n </div>\n </div>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const n='<div\n class="switch"\n :class="this.getSwitchClasses()"\n @click="this.handleClick()"\n tabindex="0"\n @keydown="this.handleKeyDown(event)"\n role="switch"\n :aria-checked="$data.checked ? \'true\' : \'false\'"\n :aria-disabled="$data.disabled ? \'true\' : \'false\'"\n>\n <div class="switch__track">\n <div class="switch__inner">\n <If test="this.hasCheckedSlot()">\n <span class="switch__inner-checked">\n <slot name="checked"></slot>\n </span>\n </If>\n <ElseIf test="$data.checkedChildren">\n <span class="switch__inner-checked">{{$data.checkedChildren}}</span>\n </ElseIf>\n <If test="this.hasUncheckedSlot()">\n <span class="switch__inner-unchecked">\n <slot name="unchecked"></slot>\n </span>\n </If>\n <ElseIf test="$data.unCheckedChildren">\n <span class="switch__inner-unchecked">{{$data.unCheckedChildren}}</span>\n </ElseIf>\n </div>\n <div class="switch__handle">\n <If test="$data.loading">\n <span class="switch__loading-icon"></span>\n </If>\n </div>\n </div>\n</div>\n';export{n as default};
|
|
1
|
+
const n='<div\n part="base"\n class="switch"\n :class="this.getSwitchClasses()"\n @click="this.handleClick()"\n tabindex="0"\n @keydown="this.handleKeyDown(event)"\n role="switch"\n :aria-checked="$data.checked ? \'true\' : \'false\'"\n :aria-disabled="$data.disabled ? \'true\' : \'false\'"\n>\n <div part="track" class="switch__track">\n <div part="inner" class="switch__inner">\n <If test="this.hasCheckedSlot()">\n <span part="checked-text" class="switch__inner-checked">\n <slot name="checked"></slot>\n </span>\n </If>\n <ElseIf test="$data.checkedChildren">\n <span part="checked-text" class="switch__inner-checked">{{$data.checkedChildren}}</span>\n </ElseIf>\n <If test="this.hasUncheckedSlot()">\n <span part="unchecked-text" class="switch__inner-unchecked">\n <slot name="unchecked"></slot>\n </span>\n </If>\n <ElseIf test="$data.unCheckedChildren">\n <span part="unchecked-text" class="switch__inner-unchecked">{{$data.unCheckedChildren}}</span>\n </ElseIf>\n </div>\n <div part="handle" class="switch__handle">\n <If test="$data.loading">\n <span part="loading-icon" class="switch__loading-icon"></span>\n </If>\n </div>\n </div>\n</div>\n';export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="table-wrapper">\n <table class="table" :class="this.getTableClasses()">\n <thead>\n <tr>\n <For each="this.getParsedColumns()" item="col">\n <th :class="this.getThClasses(col)"\n :style="col.width ? \'width: \' + (typeof col.width === \'number\' ? col.width + \'px\' : col.width) : \'\'">\n {{col.title}}\n </th>\n </For>\n </tr>\n </thead>\n <tbody>\n <For each="this.getParsedDataSource()" item="row" index="rowIndex">\n <tr @click="this.handleRowClick(row, rowIndex)">\n <For each="this.getParsedColumns()" item="col">\n <td :class="this.getTdClasses(col)">\n <slot :name="\'col-\' + col.key + \'-\' + rowIndex">\n {{this.getCellValue(row, col)}}\n </slot>\n </td>\n </For>\n </tr>\n </For>\n </tbody>\n </table>\n\n \x3c!-- 加载状态 --\x3e\n <If condition="$data.loading">\n <div class="table__loading">\n <span class="table__loading-icon"></span>\n </div>\n </If>\n\n \x3c!-- 空状态 --\x3e\n <If condition="!$data.loading && this.getParsedDataSource().length === 0">\n <div class="table__empty">\n 暂无数据\n </div>\n </If>\n</div>';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div part="wrapper" class="table-wrapper">\n <table part="base" class="table" :class="this.getTableClasses()">\n <thead part="head">\n <tr part="head-row">\n <For each="this.getParsedColumns()" item="col">\n <th part="head-cell" :class="this.getThClasses(col)"\n :style="col.width ? \'width: \' + (typeof col.width === \'number\' ? col.width + \'px\' : col.width) : \'\'">\n {{col.title}}\n </th>\n </For>\n </tr>\n </thead>\n <tbody part="body">\n <For each="this.getParsedDataSource()" item="row" index="rowIndex">\n <tr part="row" @click="this.handleRowClick(row, rowIndex)">\n <For each="this.getParsedColumns()" item="col">\n <td part="cell" :class="this.getTdClasses(col)">\n <slot :name="\'col-\' + col.key + \'-\' + rowIndex">\n {{this.getCellValue(row, col)}}\n </slot>\n </td>\n </For>\n </tr>\n </For>\n </tbody>\n </table>\n\n \x3c!-- 加载状态 --\x3e\n <If condition="$data.loading">\n <div part="loading" class="table__loading">\n <span part="loading-icon" class="table__loading-icon"></span>\n </div>\n </If>\n\n \x3c!-- 空状态 --\x3e\n <If condition="!$data.loading && this.getParsedDataSource().length === 0">\n <div part="empty" class="table__empty">\n 暂无数据\n </div>\n </If>\n</div>';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t='<div part="wrapper" class="table-wrapper">\n <table part="base" class="table" :class="this.getTableClasses()">\n <thead part="head">\n <tr part="head-row">\n <For each="this.getParsedColumns()" item="col">\n <th part="head-cell" :class="this.getThClasses(col)"\n :style="col.width ? \'width: \' + (typeof col.width === \'number\' ? col.width + \'px\' : col.width) : \'\'">\n {{col.title}}\n </th>\n </For>\n </tr>\n </thead>\n <tbody part="body">\n <For each="this.getParsedDataSource()" item="row" index="rowIndex">\n <tr part="row" @click="this.handleRowClick(row, rowIndex)">\n <For each="this.getParsedColumns()" item="col">\n <td part="cell" :class="this.getTdClasses(col)">\n <slot :name="\'col-\' + col.key + \'-\' + rowIndex">\n {{this.getCellValue(row, col)}}\n </slot>\n </td>\n </For>\n </tr>\n </For>\n </tbody>\n </table>\n\n \x3c!-- 加载状态 --\x3e\n <If condition="$data.loading">\n <div part="loading" class="table__loading">\n <span part="loading-icon" class="table__loading-icon"></span>\n </div>\n </If>\n\n \x3c!-- 空状态 --\x3e\n <If condition="!$data.loading && this.getParsedDataSource().length === 0">\n <div part="empty" class="table__empty">\n 暂无数据\n </div>\n </If>\n</div>';export{t as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="tabs"\n
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n part="base"\n class="tabs"\n :class="this.getTabsClasses()"\n role="tablist"\n>\n \x3c!-- 标签栏 --\x3e\n <div part="nav" class="tabs__nav">\n <For each="this.getParsedItems()" item="item">\n <div\n part="tab"\n class="tabs__tab"\n :class="this.getTabClasses(item)"\n role="tab"\n :aria-selected="item.key === $data.activeKey ? \'true\' : \'false\'"\n :aria-controls="\'panel-\' + item.key"\n :tabindex="item.key === $data.activeKey ? \'0\' : \'-1\'"\n @click="this.handleTabClick(item)"\n >\n {{item.label}}\n <If test="$data.closable && this.getParsedItems().length > 1">\n <span\n part="close"\n class="tabs__close"\n @click="this.handleClose(item, event)"\n role="button"\n aria-label="关闭标签"\n tabindex="0"\n >×</span>\n </If>\n </div>\n </For>\n <If test="$data.addable">\n <span\n part="add"\n class="tabs__add"\n @click="this.handleAdd(event)"\n role="button"\n aria-label="新增标签"\n tabindex="0"\n >+</span>\n </If>\n </div>\n\n \x3c!-- 内容区 --\x3e\n <div part="content" class="tabs__content">\n <For each="this.getParsedItems()" item="item">\n <div\n part="pane"\n class="tabs__pane"\n :class="this.getPaneClasses(item)"\n :id="\'panel-\' + item.key"\n role="tabpanel"\n :aria-hidden="item.key !== $data.activeKey ? \'true\' : \'false\'"\n >\n <slot :name="\'tab-\' + item.key"></slot>\n </div>\n </For>\n </div>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a='<div\n part="base"\n class="tabs"\n :class="this.getTabsClasses()"\n role="tablist"\n>\n \x3c!-- 标签栏 --\x3e\n <div part="nav" class="tabs__nav">\n <For each="this.getParsedItems()" item="item">\n <div\n part="tab"\n class="tabs__tab"\n :class="this.getTabClasses(item)"\n role="tab"\n :aria-selected="item.key === $data.activeKey ? \'true\' : \'false\'"\n :aria-controls="\'panel-\' + item.key"\n :tabindex="item.key === $data.activeKey ? \'0\' : \'-1\'"\n @click="this.handleTabClick(item)"\n >\n {{item.label}}\n <If test="$data.closable && this.getParsedItems().length > 1">\n <span\n part="close"\n class="tabs__close"\n @click="this.handleClose(item, event)"\n role="button"\n aria-label="关闭标签"\n tabindex="0"\n >×</span>\n </If>\n </div>\n </For>\n <If test="$data.addable">\n <span\n part="add"\n class="tabs__add"\n @click="this.handleAdd(event)"\n role="button"\n aria-label="新增标签"\n tabindex="0"\n >+</span>\n </If>\n </div>\n\n \x3c!-- 内容区 --\x3e\n <div part="content" class="tabs__content">\n <For each="this.getParsedItems()" item="item">\n <div\n part="pane"\n class="tabs__pane"\n :class="this.getPaneClasses(item)"\n :id="\'panel-\' + item.key"\n role="tabpanel"\n :aria-hidden="item.key !== $data.activeKey ? \'true\' : \'false\'"\n >\n <slot :name="\'tab-\' + item.key"></slot>\n </div>\n </For>\n </div>\n</div>\n';export{a as default};
|
|
@@ -28,3 +28,13 @@ export interface TabsProps {
|
|
|
28
28
|
/** 是否可新增 */
|
|
29
29
|
addable: boolean;
|
|
30
30
|
}
|
|
31
|
+
/** close 事件 detail */
|
|
32
|
+
export interface TabsCloseEventDetail {
|
|
33
|
+
key: string;
|
|
34
|
+
label: string;
|
|
35
|
+
}
|
|
36
|
+
/** add 事件 detail */
|
|
37
|
+
export interface TabsAddEventDetail {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<span\n class="tag"\n :class="this.getTagClasses()"\n :style="$data.color ? \'background-color: \' + $data.color + \'; border-color: \' + $data.color : \'\'"\n>\n <slot>{{$data.content}}</slot>\n <If test="$data.closable && !$data.disabled">\n <span\n class="tag__close"\n @click="this.handleClose(event)"\n >\n <slot name="close-icon">×</slot>\n </span>\n </If>\n</span>\n';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<span\n part="base"\n class="tag"\n :class="this.getTagClasses()"\n :style="$data.color ? \'background-color: \' + $data.color + \'; border-color: \' + $data.color : \'\'"\n>\n <slot>{{$data.content}}</slot>\n <If test="$data.closable && !$data.disabled">\n <span\n part="close"\n class="tag__close"\n @click="this.handleClose(event)"\n >\n <slot name="close-icon">×</slot>\n </span>\n </If>\n</span>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const a='<span\n class="tag"\n :class="this.getTagClasses()"\n :style="$data.color ? \'background-color: \' + $data.color + \'; border-color: \' + $data.color : \'\'"\n>\n <slot>{{$data.content}}</slot>\n <If test="$data.closable && !$data.disabled">\n <span\n class="tag__close"\n @click="this.handleClose(event)"\n >\n <slot name="close-icon">×</slot>\n </span>\n </If>\n</span>\n';export{a as default};
|
|
1
|
+
const a='<span\n part="base"\n class="tag"\n :class="this.getTagClasses()"\n :style="$data.color ? \'background-color: \' + $data.color + \'; border-color: \' + $data.color : \'\'"\n>\n <slot>{{$data.content}}</slot>\n <If test="$data.closable && !$data.disabled">\n <span\n part="close"\n class="tag__close"\n @click="this.handleClose(event)"\n >\n <slot name="close-icon">×</slot>\n </span>\n </If>\n</span>\n';export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="timeline"\n :class="this.getTimelineClasses()"\n>\n <ul class="timeline__list">\n <For each="this.getParsedItems()" item="item" index="index">\n <li\n class="timeline__item"\n :class="this.getItemClasses(item, index)"\n >\n <div class="timeline__item-tail"></div>\n <div class="timeline__item-wrapper">\n <div class="timeline__item-head">\n <If test="item.loading">\n <div\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </If>\n <ElseIf test="item.icon">\n <div\n class="timeline__icon-wrapper"\n :style="this.getIconStyle(item)"\n >{{item.icon}}</div>\n </ElseIf>\n <Else>\n <div\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </Else>\n </div>\n <div class="timeline__item-content">\n <div class="timeline__title">{{item.title}}</div>\n <If test="item.content">\n <div class="timeline__content-text">{{item.content}}</div>\n </If>\n <If test="item.time">\n <div class="timeline__time">{{item.time}}</div>\n </If>\n </div>\n </div>\n </li>\n </For>\n\n <If test="$data.pending">\n <li class="timeline__item timeline__item--pending">\n <div class="timeline__item-tail"></div>\n <div class="timeline__item-wrapper">\n <div class="timeline__item-head">\n <div class="timeline__dot"></div>\n </div>\n <div class="timeline__item-content">\n <span>{{$data.pendingContent || \'待定\'}}</span>\n </div>\n </div>\n </li>\n </If>\n </ul>\n</div>\n';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n part="base"\n class="timeline"\n :class="this.getTimelineClasses()"\n>\n <ul part="list" class="timeline__list">\n <For each="this.getParsedItems()" item="item" index="index">\n <li\n part="item"\n class="timeline__item"\n :class="this.getItemClasses(item, index)"\n >\n <div part="tail" class="timeline__item-tail"></div>\n <div part="item-wrapper" class="timeline__item-wrapper">\n <div part="head" class="timeline__item-head">\n <If test="item.loading">\n <div\n part="dot"\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </If>\n <ElseIf test="item.icon">\n <div\n part="icon-wrapper"\n class="timeline__icon-wrapper"\n :style="this.getIconStyle(item)"\n >{{item.icon}}</div>\n </ElseIf>\n <Else>\n <div\n part="dot"\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </Else>\n </div>\n <div part="item-content" class="timeline__item-content">\n <div part="title" class="timeline__title">{{item.title}}</div>\n <If test="item.content">\n <div part="content-text" class="timeline__content-text">{{item.content}}</div>\n </If>\n <If test="item.time">\n <div part="time" class="timeline__time">{{item.time}}</div>\n </If>\n </div>\n </div>\n </li>\n </For>\n\n <If test="$data.pending">\n <li part="item" class="timeline__item timeline__item--pending">\n <div part="tail" class="timeline__item-tail"></div>\n <div part="item-wrapper" class="timeline__item-wrapper">\n <div part="head" class="timeline__item-head">\n <div part="dot" class="timeline__dot"></div>\n </div>\n <div part="item-content" class="timeline__item-content">\n <span>{{$data.pendingContent || \'待定\'}}</span>\n </div>\n </div>\n </li>\n </If>\n </ul>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t='<div\n part="base"\n class="timeline"\n :class="this.getTimelineClasses()"\n>\n <ul part="list" class="timeline__list">\n <For each="this.getParsedItems()" item="item" index="index">\n <li\n part="item"\n class="timeline__item"\n :class="this.getItemClasses(item, index)"\n >\n <div part="tail" class="timeline__item-tail"></div>\n <div part="item-wrapper" class="timeline__item-wrapper">\n <div part="head" class="timeline__item-head">\n <If test="item.loading">\n <div\n part="dot"\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </If>\n <ElseIf test="item.icon">\n <div\n part="icon-wrapper"\n class="timeline__icon-wrapper"\n :style="this.getIconStyle(item)"\n >{{item.icon}}</div>\n </ElseIf>\n <Else>\n <div\n part="dot"\n class="timeline__dot"\n :class="this.getDotClasses(item)"\n :style="this.getDotStyle(item)"\n ></div>\n </Else>\n </div>\n <div part="item-content" class="timeline__item-content">\n <div part="title" class="timeline__title">{{item.title}}</div>\n <If test="item.content">\n <div part="content-text" class="timeline__content-text">{{item.content}}</div>\n </If>\n <If test="item.time">\n <div part="time" class="timeline__time">{{item.time}}</div>\n </If>\n </div>\n </div>\n </li>\n </For>\n\n <If test="$data.pending">\n <li part="item" class="timeline__item timeline__item--pending">\n <div part="tail" class="timeline__item-tail"></div>\n <div part="item-wrapper" class="timeline__item-wrapper">\n <div part="head" class="timeline__item-head">\n <div part="dot" class="timeline__dot"></div>\n </div>\n <div part="item-content" class="timeline__item-content">\n <span>{{$data.pendingContent || \'待定\'}}</span>\n </div>\n </div>\n </li>\n </If>\n </ul>\n</div>\n';export{t as default};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BaseElement } from '../../../runtime/component';
|
|
2
|
+
import { TooltipProps } from './types';
|
|
3
|
+
declare class SolelyTooltip extends BaseElement<TooltipProps> {
|
|
4
|
+
private _clickOutsideHandler?;
|
|
5
|
+
/**
|
|
6
|
+
* 获取 tooltip class 对象
|
|
7
|
+
*/
|
|
8
|
+
getTooltipClasses(): Record<string, boolean>;
|
|
9
|
+
/**
|
|
10
|
+
* 显示 tooltip
|
|
11
|
+
*/
|
|
12
|
+
show(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 隐藏 tooltip
|
|
15
|
+
*/
|
|
16
|
+
hide(): void;
|
|
17
|
+
/**
|
|
18
|
+
* 鼠标移入处理
|
|
19
|
+
*/
|
|
20
|
+
handleMouseEnter(event: Event): void;
|
|
21
|
+
/**
|
|
22
|
+
* 鼠标移出处理
|
|
23
|
+
*/
|
|
24
|
+
handleMouseLeave(event: Event): void;
|
|
25
|
+
/**
|
|
26
|
+
* 聚焦处理
|
|
27
|
+
*/
|
|
28
|
+
handleFocus(event: Event): void;
|
|
29
|
+
/**
|
|
30
|
+
* 失焦处理
|
|
31
|
+
*/
|
|
32
|
+
handleBlur(event: Event): void;
|
|
33
|
+
/**
|
|
34
|
+
* 绑定事件到 slot 内容元素
|
|
35
|
+
*/
|
|
36
|
+
private bindSlotEvents;
|
|
37
|
+
/**
|
|
38
|
+
* 点击处理
|
|
39
|
+
*/
|
|
40
|
+
handleClick(event: Event): void;
|
|
41
|
+
/**
|
|
42
|
+
* 绑定点击外部关闭
|
|
43
|
+
*/
|
|
44
|
+
private bindClickOutside;
|
|
45
|
+
/**
|
|
46
|
+
* 解绑点击外部关闭
|
|
47
|
+
*/
|
|
48
|
+
private unbindClickOutside;
|
|
49
|
+
/**
|
|
50
|
+
* 组件挂载后初始化
|
|
51
|
+
*/
|
|
52
|
+
mounted(): void;
|
|
53
|
+
/**
|
|
54
|
+
* 组件销毁时清理
|
|
55
|
+
*/
|
|
56
|
+
unmounted(): void;
|
|
57
|
+
}
|
|
58
|
+
export default SolelyTooltip;
|
|
59
|
+
export { SolelyTooltip };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip 组件类型定义
|
|
3
|
+
*/
|
|
4
|
+
export type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right' | 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'leftTop' | 'leftBottom' | 'rightTop' | 'rightBottom';
|
|
5
|
+
export type TooltipTrigger = 'hover' | 'click' | 'focus';
|
|
6
|
+
export interface TooltipProps {
|
|
7
|
+
/** 提示内容 */
|
|
8
|
+
content: string;
|
|
9
|
+
/** 气泡框位置 */
|
|
10
|
+
placement: TooltipPlacement;
|
|
11
|
+
/** 触发方式 */
|
|
12
|
+
trigger: TooltipTrigger;
|
|
13
|
+
/** 是否显示 */
|
|
14
|
+
visible: boolean;
|
|
15
|
+
/** 背景颜色 */
|
|
16
|
+
color: string;
|
|
17
|
+
/** 最大宽度 */
|
|
18
|
+
maxWidth: number;
|
|
19
|
+
}
|
|
20
|
+
export interface TooltipRefs extends Record<string, Element> {
|
|
21
|
+
tooltipRef: HTMLElement;
|
|
22
|
+
arrowRef: HTMLElement;
|
|
23
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div class="tree"
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div part="base" class="tree" :class="this.getTreeClasses()" role="tree">\n <ul part="list" class="tree__list">\n <For each="$data.flattenedTree" item="node">\n <li\n part="node"\n class="tree__node"\n :class="this.getNodeClasses(node)"\n :style="\'padding-left: \' + (node.level * 24 + 12) + \'px\'"\n role="treeitem"\n :aria-expanded="node.children && node.children.length > 0 ? (node.expanded ? \'true\' : \'false\') : undefined"\n :aria-selected="node.selected ? \'true\' : \'false\'"\n :aria-disabled="node.disabled ? \'true\' : \'false\'"\n :aria-level="node.level + 1"\n >\n <div\n part="content"\n class="tree__content"\n :class="this.getContentClasses(node)"\n @click="this.handleNodeClick(node)"\n >\n \x3c!-- 展开/折叠图标 --\x3e\n <span\n part="switcher"\n class="tree__switcher"\n :class="this.getSwitcherClasses(node)"\n @click="this.handleToggle(node, event)"\n role="button"\n :aria-label="node.expanded ? \'折叠\' : \'展开\'"\n tabindex="0"\n >\n ▶\n </span>\n\n \x3c!-- 复选框 --\x3e\n <If condition="$data.checkable">\n <span\n part="checkbox"\n class="tree__checkbox"\n :class="this.getCheckboxClasses(node)"\n @click="this.handleCheck(node, event)"\n role="checkbox"\n :aria-checked="node.halfChecked ? \'mixed\' : (node.checked ? \'true\' : \'false\')"\n :aria-disabled="node.disabled ? \'true\' : \'false\'"\n tabindex="0"\n ></span>\n </If>\n\n \x3c!-- 节点图标 --\x3e\n <If condition="node.icon">\n <span part="icon" class="tree__icon">{{node.icon}}</span>\n </If>\n\n \x3c!-- 节点标题 --\x3e\n <span part="title" class="tree__title">{{node.title}}</span>\n </div>\n </li>\n </For>\n </ul>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e='<div part="base" class="tree" :class="this.getTreeClasses()" role="tree">\n <ul part="list" class="tree__list">\n <For each="$data.flattenedTree" item="node">\n <li\n part="node"\n class="tree__node"\n :class="this.getNodeClasses(node)"\n :style="\'padding-left: \' + (node.level * 24 + 12) + \'px\'"\n role="treeitem"\n :aria-expanded="node.children && node.children.length > 0 ? (node.expanded ? \'true\' : \'false\') : undefined"\n :aria-selected="node.selected ? \'true\' : \'false\'"\n :aria-disabled="node.disabled ? \'true\' : \'false\'"\n :aria-level="node.level + 1"\n >\n <div\n part="content"\n class="tree__content"\n :class="this.getContentClasses(node)"\n @click="this.handleNodeClick(node)"\n >\n \x3c!-- 展开/折叠图标 --\x3e\n <span\n part="switcher"\n class="tree__switcher"\n :class="this.getSwitcherClasses(node)"\n @click="this.handleToggle(node, event)"\n role="button"\n :aria-label="node.expanded ? \'折叠\' : \'展开\'"\n tabindex="0"\n >\n ▶\n </span>\n\n \x3c!-- 复选框 --\x3e\n <If condition="$data.checkable">\n <span\n part="checkbox"\n class="tree__checkbox"\n :class="this.getCheckboxClasses(node)"\n @click="this.handleCheck(node, event)"\n role="checkbox"\n :aria-checked="node.halfChecked ? \'mixed\' : (node.checked ? \'true\' : \'false\')"\n :aria-disabled="node.disabled ? \'true\' : \'false\'"\n tabindex="0"\n ></span>\n </If>\n\n \x3c!-- 节点图标 --\x3e\n <If condition="node.icon">\n <span part="icon" class="tree__icon">{{node.icon}}</span>\n </If>\n\n \x3c!-- 节点标题 --\x3e\n <span part="title" class="tree__title">{{node.title}}</span>\n </div>\n </li>\n </For>\n </ul>\n</div>\n';export{e as default};
|
|
@@ -45,3 +45,20 @@ export interface TreeProps {
|
|
|
45
45
|
/** 是否撑满父容器宽度 */
|
|
46
46
|
block?: boolean;
|
|
47
47
|
}
|
|
48
|
+
/** select 事件 detail */
|
|
49
|
+
export interface TreeSelectEventDetail {
|
|
50
|
+
selectedKeys: string[];
|
|
51
|
+
selectedNodes: TreeNode[];
|
|
52
|
+
node: TreeNode;
|
|
53
|
+
}
|
|
54
|
+
/** check 事件 detail */
|
|
55
|
+
export interface TreeCheckEventDetail {
|
|
56
|
+
checkedKeys: string[];
|
|
57
|
+
checkedNodes: TreeNode[];
|
|
58
|
+
node: TreeNode;
|
|
59
|
+
}
|
|
60
|
+
/** expand 事件 detail */
|
|
61
|
+
export interface TreeExpandEventDetail {
|
|
62
|
+
expandedKeys: string[];
|
|
63
|
+
node: TreeNode;
|
|
64
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyUpload=class extends a.default{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.refresh(),this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s.safeJsonParse(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}},exports.SolelyUpload=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-upload",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],exports.SolelyUpload);
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./style.css.cjs"),t=require("./index.html.cjs"),s=require("../utils/helpers.cjs"),a=require("../../../runtime/component/base-element.cjs"),i=require("../../../runtime/component/decorators.cjs");Object.getOwnPropertyDescriptor;exports.SolelyUpload=class extends a.default{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}set fileList(e){this.$data.parsedFileList=e,this.$data.fileList=JSON.stringify(e)}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.refresh(),this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s.safeJsonParse(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}},exports.SolelyUpload=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i.CustomElement({tagName:"solely-upload",template:t.default,styles:e.default,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],exports.SolelyUpload);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n class="upload"\n :class="this.getUploadClasses()"\n>\n \x3c!-- 拖拽上传 --\x3e\n <If condition="$data.drag">\n <div\n class="upload__drag"\n :class="this.getDragClasses()"\n @click="this.triggerUpload(event)"\n @dragover="this.handleDragOver(event)"\n @dragleave="this.handleDragLeave(event)"\n @drop="this.handleDrop(event)"\n >\n <div class="upload__drag-icon">☁️</div>\n <div class="upload__drag-text">{{$data.buttonText || \'点击或拖拽文件到此区域上传\'}}</div>\n <div class="upload__drag-hint">支持单个或批量上传</div>\n </div>\n </If>\n\n \x3c!-- 普通上传按钮 --\x3e\n <If condition="!$data.drag">\n <div\n class="upload__button"\n @click="this.triggerUpload(event)"\n >\n <span>+</span>\n <span>{{$data.buttonText || \'上传文件\'}}</span>\n </div>\n </If>\n\n \x3c!-- 隐藏的文件输入 --\x3e\n <input\n ref="fileInput"\n type="file"\n class="upload__input"\n :accept="$data.accept"\n :multiple="$data.multiple"\n @change="this.handleFileChange(event)"\n />\n\n \x3c!-- 文件列表 --\x3e\n <If condition="$data.showUploadList && $data.parsedFileList?.length > 0">\n <ul class="upload__list">\n <For each="$data.parsedFileList" item="file">\n <li\n class="upload__list-item"\n :class="{ \'upload__list-item--error\': file.status === \'error\' }"\n >\n <If condition="file.url && ($data.listType === \'picture\' || $data.listType === \'picture-card\')">\n <img\n class="upload__list-thumb"\n :src="file.url"\n :alt="file.name"\n />\n </If>\n <div class="upload__list-info">\n <div class="upload__list-name">{{file.name}}</div>\n <If condition="file.size">\n <div class="upload__list-size">{{this.formatSize(file.size)}}</div>\n </If>\n <If condition="file.status === \'uploading\'">\n <div class="upload__progress">\n <div class="upload__progress-bar" :style="\'width: \' + (file.percent || 0) + \'%\'"></div>\n </div>\n </If>\n </div>\n <span\n class="upload__list-status"\n :class="\'upload__list-status--\' + file.status"\n >\n {{this.getStatusText(file.status)}}\n </span>\n <span class="upload__list-remove" @click="this.handleRemove(file)">×</span>\n </li>\n </For>\n </ul>\n </If>\n</div>\n';
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),exports.default='<div\n part="base"\n class="upload"\n :class="this.getUploadClasses()"\n>\n \x3c!-- 拖拽上传 --\x3e\n <If condition="$data.drag">\n <div\n part="drag"\n class="upload__drag"\n :class="this.getDragClasses()"\n @click="this.triggerUpload(event)"\n @dragover="this.handleDragOver(event)"\n @dragleave="this.handleDragLeave(event)"\n @drop="this.handleDrop(event)"\n >\n <div part="drag-icon" class="upload__drag-icon">☁️</div>\n <div part="drag-text" class="upload__drag-text">{{$data.buttonText || \'点击或拖拽文件到此区域上传\'}}</div>\n <div part="drag-hint" class="upload__drag-hint">支持单个或批量上传</div>\n </div>\n </If>\n\n \x3c!-- 普通上传按钮 --\x3e\n <If condition="!$data.drag">\n <div\n part="button"\n class="upload__button"\n @click="this.triggerUpload(event)"\n >\n <span>+</span>\n <span>{{$data.buttonText || \'上传文件\'}}</span>\n </div>\n </If>\n\n \x3c!-- 隐藏的文件输入 --\x3e\n <input\n ref="fileInput"\n type="file"\n class="upload__input"\n :accept="$data.accept"\n :multiple="$data.multiple"\n @change="this.handleFileChange(event)"\n />\n\n \x3c!-- 文件列表 --\x3e\n <If condition="$data.showUploadList && $data.parsedFileList?.length > 0">\n <ul part="list" class="upload__list">\n <For each="$data.parsedFileList" item="file">\n <li\n part="list-item"\n class="upload__list-item"\n :class="{ \'upload__list-item--error\': file.status === \'error\' }"\n >\n <If condition="file.url && ($data.listType === \'picture\' || $data.listType === \'picture-card\')">\n <img\n part="thumb"\n class="upload__list-thumb"\n :src="file.url"\n :alt="file.name"\n />\n </If>\n <div part="info" class="upload__list-info">\n <div part="name" class="upload__list-name">{{file.name}}</div>\n <If condition="file.size">\n <div part="size" class="upload__list-size">{{this.formatSize(file.size)}}</div>\n </If>\n <If condition="file.status === \'uploading\'">\n <div part="progress" class="upload__progress">\n <div part="progress-bar" class="upload__progress-bar" :style="\'width: \' + (file.percent || 0) + \'%\'"></div>\n </div>\n </If>\n </div>\n <span\n part="status"\n class="upload__list-status"\n :class="\'upload__list-status--\' + file.status"\n >\n {{this.getStatusText(file.status)}}\n </span>\n <span part="remove" class="upload__list-remove" @click="this.handleRemove(file)">×</span>\n </li>\n </For>\n </ul>\n </If>\n</div>\n';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a='<div\n part="base"\n class="upload"\n :class="this.getUploadClasses()"\n>\n \x3c!-- 拖拽上传 --\x3e\n <If condition="$data.drag">\n <div\n part="drag"\n class="upload__drag"\n :class="this.getDragClasses()"\n @click="this.triggerUpload(event)"\n @dragover="this.handleDragOver(event)"\n @dragleave="this.handleDragLeave(event)"\n @drop="this.handleDrop(event)"\n >\n <div part="drag-icon" class="upload__drag-icon">☁️</div>\n <div part="drag-text" class="upload__drag-text">{{$data.buttonText || \'点击或拖拽文件到此区域上传\'}}</div>\n <div part="drag-hint" class="upload__drag-hint">支持单个或批量上传</div>\n </div>\n </If>\n\n \x3c!-- 普通上传按钮 --\x3e\n <If condition="!$data.drag">\n <div\n part="button"\n class="upload__button"\n @click="this.triggerUpload(event)"\n >\n <span>+</span>\n <span>{{$data.buttonText || \'上传文件\'}}</span>\n </div>\n </If>\n\n \x3c!-- 隐藏的文件输入 --\x3e\n <input\n ref="fileInput"\n type="file"\n class="upload__input"\n :accept="$data.accept"\n :multiple="$data.multiple"\n @change="this.handleFileChange(event)"\n />\n\n \x3c!-- 文件列表 --\x3e\n <If condition="$data.showUploadList && $data.parsedFileList?.length > 0">\n <ul part="list" class="upload__list">\n <For each="$data.parsedFileList" item="file">\n <li\n part="list-item"\n class="upload__list-item"\n :class="{ \'upload__list-item--error\': file.status === \'error\' }"\n >\n <If condition="file.url && ($data.listType === \'picture\' || $data.listType === \'picture-card\')">\n <img\n part="thumb"\n class="upload__list-thumb"\n :src="file.url"\n :alt="file.name"\n />\n </If>\n <div part="info" class="upload__list-info">\n <div part="name" class="upload__list-name">{{file.name}}</div>\n <If condition="file.size">\n <div part="size" class="upload__list-size">{{this.formatSize(file.size)}}</div>\n </If>\n <If condition="file.status === \'uploading\'">\n <div part="progress" class="upload__progress">\n <div part="progress-bar" class="upload__progress-bar" :style="\'width: \' + (file.percent || 0) + \'%\'"></div>\n </div>\n </If>\n </div>\n <span\n part="status"\n class="upload__list-status"\n :class="\'upload__list-status--\' + file.status"\n >\n {{this.getStatusText(file.status)}}\n </span>\n <span part="remove" class="upload__list-remove" @click="this.handleRemove(file)">×</span>\n </li>\n </For>\n </ul>\n </If>\n</div>\n';export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as s}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends a{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.refresh(),this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}};r=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i({tagName:"solely-upload",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],r);export{r as SolelyUpload};
|
|
1
|
+
import e from"./style.css.js";import t from"./index.html.js";import{safeJsonParse as s}from"../utils/helpers.js";import a from"../../../runtime/component/base-element.js";import{CustomElement as i}from"../../../runtime/component/decorators.js";Object.getOwnPropertyDescriptor;let r=class extends a{getUploadClasses(){const e={};return this.$data.listType&&(e[`upload--${this.$data.listType}`]=!0),e["is-disabled"]=!!this.$data.disabled,e}get fileList(){return this.$data.parsedFileList}set fileList(e){this.$data.parsedFileList=e,this.$data.fileList=JSON.stringify(e)}getDragClasses(){return{"upload__drag--active":!!this.$data.isDragging}}mounted(){this.refresh(),this.parseFileList(),this.$data.isDragging=!1}parseFileList(){this.$data.parsedFileList=s(this.$data.fileList,[])}triggerUpload(){var e;if(this.$data.disabled)return;const t=null==(e=this.shadowRoot)?void 0:e.querySelector('input[type="file"]');t&&t.click()}handleFileChange(e){const t=e.target,s=t.files;s&&s.length>0&&this.handleFiles(s),t.value=""}handleFiles(e){const t=this.$data.maxCount||1/0,s=this.$data.maxSize||1/0;Array.from(e).forEach(e=>{if(this.$data.parsedFileList.length>=t)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件数量超过限制 (最多 ${t} 个)`});if(e.size>s)return void this.emit("error",{file:{name:e.name,size:e.size},message:`文件大小超过限制 (${this.formatSize(s)})`});const a={uid:Date.now()+Math.random().toString(36).substr(2,9),name:e.name,size:e.size,type:e.type,status:"uploading",percent:0};this.$data.parsedFileList.push(a),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.uploadFile(a,e)})}uploadFile(e,t){if(!this.$data.action)return e.status="done",e.percent=100,e.url=URL.createObjectURL(t),this.refresh(),this.emit("success",{file:e,fileList:this.$data.parsedFileList}),void this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}));const s=new XMLHttpRequest,a=new FormData;a.append("file",t),s.upload.addEventListener("progress",t=>{t.lengthComputable&&(e.percent=Math.round(t.loaded/t.total*100),this.$data.parsedFileList=[...this.$data.parsedFileList])}),s.addEventListener("load",()=>{if(s.status>=200&&s.status<300){e.status="done",e.percent=100;try{const t=JSON.parse(s.responseText);t.url&&(e.url=t.url)}catch{}this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("success",{file:e,fileList:this.$data.parsedFileList})}else e.status="error",e.error=s.statusText,this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:s.statusText});this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.addEventListener("error",()=>{e.status="error",e.error="网络错误",this.$data.parsedFileList=[...this.$data.parsedFileList],this.emit("error",{file:e,message:"网络错误"}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}),s.open("POST",this.$data.action,!0),s.send(a)}handleDragOver(e){e.preventDefault(),this.$data.isDragging=!0}handleDragLeave(e){e.preventDefault(),this.$data.isDragging=!1}handleDrop(e){var t;e.preventDefault(),this.$data.isDragging=!1;const s=null==(t=e.dataTransfer)?void 0:t.files;s&&s.length>0&&this.handleFiles(s)}handleRemove(e){const t=this.$data.parsedFileList.findIndex(t=>t.uid===e.uid);t>-1&&(this.$data.parsedFileList.splice(t,1),this.emit("remove",{file:e,fileList:this.$data.parsedFileList}),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}formatSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB"][t]}getStatusText(e){return{uploading:"上传中",done:"完成",error:"失败",removed:"已删除"}[e||""]||""}getFileList(){return this.$data.parsedFileList}clear(){this.$data.parsedFileList=[]}};r=((e,t)=>{for(var s,a=t,i=e.length-1;i>=0;i--)(s=e[i])&&(a=s(a)||a);return a})([i({tagName:"solely-upload",template:t,styles:e,shadowDOM:{use:!0,mode:"open"},props:[{name:"action",type:"string"},{name:"accept",type:"string"},{name:"multiple",type:"boolean",default:!1},{name:"fileList",type:"string"},{name:"listType",type:"string"},{name:"disabled",type:"boolean",default:!1},{name:"showUploadList",type:"boolean",default:!0},{name:"buttonText",type:"string"},{name:"drag",type:"boolean",default:!1},{name:"maxCount",type:"number"},{name:"maxSize",type:"number"},{name:"block",type:"boolean",default:!1}]})],r);export{r as SolelyUpload};
|
package/package.json
CHANGED