duoyun-ui 0.0.2
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/LICENSE +21 -0
- package/README.md +12 -0
- package/docs/.gitignore +4 -0
- package/docs/104.bundle.js +19 -0
- package/docs/283.bundle.js +47 -0
- package/docs/354.bundle.js +1133 -0
- package/docs/354.bundle.js.LICENSE.txt +13 -0
- package/docs/587.bundle.js +26 -0
- package/docs/810.bundle.js +1 -0
- package/docs/gem-book.json +84 -0
- package/docs/index.html +1 -0
- package/docs/main.bundle.js +1 -0
- package/docs/robots.txt +2 -0
- package/docs/service-worker.js +1 -0
- package/docs/workbox-62d1f9d5.js +1 -0
- package/elements/action-text.d.ts +12 -0
- package/elements/action-text.d.ts.map +1 -0
- package/elements/action-text.js +63 -0
- package/elements/action-text.js.map +1 -0
- package/elements/area-chart.d.ts +35 -0
- package/elements/area-chart.d.ts.map +1 -0
- package/elements/area-chart.js +408 -0
- package/elements/area-chart.js.map +1 -0
- package/elements/avatar.d.ts +42 -0
- package/elements/avatar.d.ts.map +1 -0
- package/elements/avatar.js +190 -0
- package/elements/avatar.js.map +1 -0
- package/elements/banner.d.ts +21 -0
- package/elements/banner.d.ts.map +1 -0
- package/elements/banner.js +136 -0
- package/elements/banner.js.map +1 -0
- package/elements/bar-chart.d.ts +23 -0
- package/elements/bar-chart.d.ts.map +1 -0
- package/elements/bar-chart.js +170 -0
- package/elements/bar-chart.js.map +1 -0
- package/elements/base/chart.d.ts +74 -0
- package/elements/base/chart.d.ts.map +1 -0
- package/elements/base/chart.js +299 -0
- package/elements/base/chart.js.map +1 -0
- package/elements/base/loadable.d.ts +16 -0
- package/elements/base/loadable.d.ts.map +1 -0
- package/elements/base/loadable.js +77 -0
- package/elements/base/loadable.js.map +1 -0
- package/elements/base/resize.d.ts +15 -0
- package/elements/base/resize.d.ts.map +1 -0
- package/elements/base/resize.js +31 -0
- package/elements/base/resize.js.map +1 -0
- package/elements/base/scroll.d.ts +11 -0
- package/elements/base/scroll.d.ts.map +1 -0
- package/elements/base/scroll.js +90 -0
- package/elements/base/scroll.js.map +1 -0
- package/elements/base/visible.d.ts +12 -0
- package/elements/base/visible.d.ts.map +1 -0
- package/elements/base/visible.js +37 -0
- package/elements/base/visible.js.map +1 -0
- package/elements/breadcrumbs.d.ts +20 -0
- package/elements/breadcrumbs.d.ts.map +1 -0
- package/elements/breadcrumbs.js +88 -0
- package/elements/breadcrumbs.js.map +1 -0
- package/elements/button.d.ts +30 -0
- package/elements/button.d.ts.map +1 -0
- package/elements/button.js +225 -0
- package/elements/button.js.map +1 -0
- package/elements/card.d.ts +26 -0
- package/elements/card.d.ts.map +1 -0
- package/elements/card.js +163 -0
- package/elements/card.js.map +1 -0
- package/elements/cascader-pick.d.ts +22 -0
- package/elements/cascader-pick.d.ts.map +1 -0
- package/elements/cascader-pick.js +172 -0
- package/elements/cascader-pick.js.map +1 -0
- package/elements/cascader.d.ts +29 -0
- package/elements/cascader.d.ts.map +1 -0
- package/elements/cascader.js +247 -0
- package/elements/cascader.js.map +1 -0
- package/elements/chart-tooltip.d.ts +29 -0
- package/elements/chart-tooltip.d.ts.map +1 -0
- package/elements/chart-tooltip.js +150 -0
- package/elements/chart-tooltip.js.map +1 -0
- package/elements/chart-zoom.d.ts +20 -0
- package/elements/chart-zoom.d.ts.map +1 -0
- package/elements/chart-zoom.js +207 -0
- package/elements/chart-zoom.js.map +1 -0
- package/elements/checkbox.d.ts +20 -0
- package/elements/checkbox.d.ts.map +1 -0
- package/elements/checkbox.js +108 -0
- package/elements/checkbox.js.map +1 -0
- package/elements/coach-mark.d.ts +39 -0
- package/elements/coach-mark.d.ts.map +1 -0
- package/elements/coach-mark.js +212 -0
- package/elements/coach-mark.js.map +1 -0
- package/elements/code-block.d.ts +14 -0
- package/elements/code-block.d.ts.map +1 -0
- package/elements/code-block.js +427 -0
- package/elements/code-block.js.map +1 -0
- package/elements/collapse.d.ts +22 -0
- package/elements/collapse.d.ts.map +1 -0
- package/elements/collapse.js +111 -0
- package/elements/collapse.js.map +1 -0
- package/elements/color-panel.d.ts +30 -0
- package/elements/color-panel.d.ts.map +1 -0
- package/elements/color-panel.js +383 -0
- package/elements/color-panel.js.map +1 -0
- package/elements/color-pick.d.ts +14 -0
- package/elements/color-pick.d.ts.map +1 -0
- package/elements/color-pick.js +81 -0
- package/elements/color-pick.js.map +1 -0
- package/elements/compartment.d.ts +9 -0
- package/elements/compartment.d.ts.map +1 -0
- package/elements/compartment.js +32 -0
- package/elements/compartment.js.map +1 -0
- package/elements/copy.d.ts +20 -0
- package/elements/copy.d.ts.map +1 -0
- package/elements/copy.js +160 -0
- package/elements/copy.js.map +1 -0
- package/elements/date-panel.d.ts +29 -0
- package/elements/date-panel.d.ts.map +1 -0
- package/elements/date-panel.js +220 -0
- package/elements/date-panel.js.map +1 -0
- package/elements/date-pick.d.ts +23 -0
- package/elements/date-pick.d.ts.map +1 -0
- package/elements/date-pick.js +107 -0
- package/elements/date-pick.js.map +1 -0
- package/elements/date-range-panel.d.ts +28 -0
- package/elements/date-range-panel.d.ts.map +1 -0
- package/elements/date-range-panel.js +154 -0
- package/elements/date-range-panel.js.map +1 -0
- package/elements/date-range-pick.d.ts +26 -0
- package/elements/date-range-pick.d.ts.map +1 -0
- package/elements/date-range-pick.js +159 -0
- package/elements/date-range-pick.js.map +1 -0
- package/elements/divider.d.ts +15 -0
- package/elements/divider.d.ts.map +1 -0
- package/elements/divider.js +95 -0
- package/elements/divider.js.map +1 -0
- package/elements/donut-chart.d.ts +19 -0
- package/elements/donut-chart.d.ts.map +1 -0
- package/elements/donut-chart.js +140 -0
- package/elements/donut-chart.js.map +1 -0
- package/elements/drawer.d.ts +9 -0
- package/elements/drawer.d.ts.map +1 -0
- package/elements/drawer.js +45 -0
- package/elements/drawer.js.map +1 -0
- package/elements/drop-area.d.ts +18 -0
- package/elements/drop-area.d.ts.map +1 -0
- package/elements/drop-area.js +155 -0
- package/elements/drop-area.js.map +1 -0
- package/elements/empty.d.ts +8 -0
- package/elements/empty.d.ts.map +1 -0
- package/elements/empty.js +33 -0
- package/elements/empty.js.map +1 -0
- package/elements/file-pick.d.ts +28 -0
- package/elements/file-pick.d.ts.map +1 -0
- package/elements/file-pick.js +226 -0
- package/elements/file-pick.js.map +1 -0
- package/elements/form.d.ts +76 -0
- package/elements/form.d.ts.map +1 -0
- package/elements/form.js +372 -0
- package/elements/form.js.map +1 -0
- package/elements/heading.d.ts +13 -0
- package/elements/heading.d.ts.map +1 -0
- package/elements/heading.js +88 -0
- package/elements/heading.js.map +1 -0
- package/elements/help-text.d.ts +11 -0
- package/elements/help-text.d.ts.map +1 -0
- package/elements/help-text.js +53 -0
- package/elements/help-text.js.map +1 -0
- package/elements/icons.d.ts +10 -0
- package/elements/icons.d.ts.map +1 -0
- package/elements/icons.js +71 -0
- package/elements/icons.js.map +1 -0
- package/elements/image-preview.d.ts +26 -0
- package/elements/image-preview.d.ts.map +1 -0
- package/elements/image-preview.js +172 -0
- package/elements/image-preview.js.map +1 -0
- package/elements/input-capture.d.ts +17 -0
- package/elements/input-capture.d.ts.map +1 -0
- package/elements/input-capture.js +111 -0
- package/elements/input-capture.js.map +1 -0
- package/elements/input.d.ts +51 -0
- package/elements/input.d.ts.map +1 -0
- package/elements/input.js +372 -0
- package/elements/input.js.map +1 -0
- package/elements/keyboard-access.d.ts +26 -0
- package/elements/keyboard-access.d.ts.map +1 -0
- package/elements/keyboard-access.js +217 -0
- package/elements/keyboard-access.js.map +1 -0
- package/elements/legend.d.ts +21 -0
- package/elements/legend.d.ts.map +1 -0
- package/elements/legend.js +118 -0
- package/elements/legend.js.map +1 -0
- package/elements/line-chart.d.ts +9 -0
- package/elements/line-chart.d.ts.map +1 -0
- package/elements/line-chart.js +116 -0
- package/elements/line-chart.js.map +1 -0
- package/elements/link.d.ts +14 -0
- package/elements/link.d.ts.map +1 -0
- package/elements/link.js +46 -0
- package/elements/link.js.map +1 -0
- package/elements/list.d.ts +30 -0
- package/elements/list.d.ts.map +1 -0
- package/elements/list.js +114 -0
- package/elements/list.js.map +1 -0
- package/elements/loading.d.ts +9 -0
- package/elements/loading.d.ts.map +1 -0
- package/elements/loading.js +44 -0
- package/elements/loading.js.map +1 -0
- package/elements/map.d.ts +68 -0
- package/elements/map.d.ts.map +1 -0
- package/elements/map.js +323 -0
- package/elements/map.js.map +1 -0
- package/elements/menu.d.ts +58 -0
- package/elements/menu.d.ts.map +1 -0
- package/elements/menu.js +256 -0
- package/elements/menu.js.map +1 -0
- package/elements/meter.d.ts +20 -0
- package/elements/meter.d.ts.map +1 -0
- package/elements/meter.js +130 -0
- package/elements/meter.js.map +1 -0
- package/elements/modal.d.ts +46 -0
- package/elements/modal.d.ts.map +1 -0
- package/elements/modal.js +296 -0
- package/elements/modal.js.map +1 -0
- package/elements/more.d.ts +28 -0
- package/elements/more.d.ts.map +1 -0
- package/elements/more.js +118 -0
- package/elements/more.js.map +1 -0
- package/elements/options.d.ts +34 -0
- package/elements/options.d.ts.map +1 -0
- package/elements/options.js +174 -0
- package/elements/options.js.map +1 -0
- package/elements/page-loadbar.d.ts +20 -0
- package/elements/page-loadbar.d.ts.map +1 -0
- package/elements/page-loadbar.js +85 -0
- package/elements/page-loadbar.js.map +1 -0
- package/elements/pagination.d.ts +23 -0
- package/elements/pagination.d.ts.map +1 -0
- package/elements/pagination.js +221 -0
- package/elements/pagination.js.map +1 -0
- package/elements/paragraph.d.ts +8 -0
- package/elements/paragraph.d.ts.map +1 -0
- package/elements/paragraph.js +60 -0
- package/elements/paragraph.js.map +1 -0
- package/elements/pick.d.ts +34 -0
- package/elements/pick.d.ts.map +1 -0
- package/elements/pick.js +168 -0
- package/elements/pick.js.map +1 -0
- package/elements/placeholder.d.ts +23 -0
- package/elements/placeholder.d.ts.map +1 -0
- package/elements/placeholder.js +93 -0
- package/elements/placeholder.js.map +1 -0
- package/elements/popover.d.ts +54 -0
- package/elements/popover.d.ts.map +1 -0
- package/elements/popover.js +316 -0
- package/elements/popover.js.map +1 -0
- package/elements/progress.d.ts +12 -0
- package/elements/progress.d.ts.map +1 -0
- package/elements/progress.js +45 -0
- package/elements/progress.js.map +1 -0
- package/elements/radio.d.ts +34 -0
- package/elements/radio.d.ts.map +1 -0
- package/elements/radio.js +152 -0
- package/elements/radio.js.map +1 -0
- package/elements/rating.d.ts +15 -0
- package/elements/rating.d.ts.map +1 -0
- package/elements/rating.js +122 -0
- package/elements/rating.js.map +1 -0
- package/elements/scatter-chart.d.ts +13 -0
- package/elements/scatter-chart.d.ts.map +1 -0
- package/elements/scatter-chart.js +151 -0
- package/elements/scatter-chart.js.map +1 -0
- package/elements/select.d.ts +63 -0
- package/elements/select.d.ts.map +1 -0
- package/elements/select.js +416 -0
- package/elements/select.js.map +1 -0
- package/elements/shortcut-record.d.ts +19 -0
- package/elements/shortcut-record.d.ts.map +1 -0
- package/elements/shortcut-record.js +127 -0
- package/elements/shortcut-record.js.map +1 -0
- package/elements/side-navigation.d.ts +31 -0
- package/elements/side-navigation.d.ts.map +1 -0
- package/elements/side-navigation.js +137 -0
- package/elements/side-navigation.js.map +1 -0
- package/elements/slider.d.ts +27 -0
- package/elements/slider.d.ts.map +1 -0
- package/elements/slider.js +219 -0
- package/elements/slider.js.map +1 -0
- package/elements/space.d.ts +10 -0
- package/elements/space.d.ts.map +1 -0
- package/elements/space.js +35 -0
- package/elements/space.js.map +1 -0
- package/elements/statistic.d.ts +24 -0
- package/elements/statistic.d.ts.map +1 -0
- package/elements/statistic.js +116 -0
- package/elements/statistic.js.map +1 -0
- package/elements/status-light.d.ts +14 -0
- package/elements/status-light.d.ts.map +1 -0
- package/elements/status-light.js +75 -0
- package/elements/status-light.js.map +1 -0
- package/elements/switch.d.ts +18 -0
- package/elements/switch.d.ts.map +1 -0
- package/elements/switch.js +117 -0
- package/elements/switch.js.map +1 -0
- package/elements/table.d.ts +36 -0
- package/elements/table.d.ts.map +1 -0
- package/elements/table.js +268 -0
- package/elements/table.js.map +1 -0
- package/elements/tabs.d.ts +29 -0
- package/elements/tabs.d.ts.map +1 -0
- package/elements/tabs.js +130 -0
- package/elements/tabs.js.map +1 -0
- package/elements/tag.d.ts +20 -0
- package/elements/tag.d.ts.map +1 -0
- package/elements/tag.js +120 -0
- package/elements/tag.js.map +1 -0
- package/elements/timeline.d.ts +19 -0
- package/elements/timeline.d.ts.map +1 -0
- package/elements/timeline.js +92 -0
- package/elements/timeline.js.map +1 -0
- package/elements/toast.d.ts +26 -0
- package/elements/toast.d.ts.map +1 -0
- package/elements/toast.js +149 -0
- package/elements/toast.js.map +1 -0
- package/elements/tooltip.d.ts +12 -0
- package/elements/tooltip.d.ts.map +1 -0
- package/elements/tooltip.js +27 -0
- package/elements/tooltip.js.map +1 -0
- package/elements/tree.d.ts +48 -0
- package/elements/tree.d.ts.map +1 -0
- package/elements/tree.js +231 -0
- package/elements/tree.js.map +1 -0
- package/elements/wait.d.ts +19 -0
- package/elements/wait.d.ts.map +1 -0
- package/elements/wait.js +97 -0
- package/elements/wait.js.map +1 -0
- package/lib/animations.d.ts +4 -0
- package/lib/animations.d.ts.map +1 -0
- package/lib/animations.js +8 -0
- package/lib/animations.js.map +1 -0
- package/lib/cache.d.ts +12 -0
- package/lib/cache.d.ts.map +1 -0
- package/lib/cache.js +56 -0
- package/lib/cache.js.map +1 -0
- package/lib/color.d.ts +37 -0
- package/lib/color.d.ts.map +1 -0
- package/lib/color.js +101 -0
- package/lib/color.js.map +1 -0
- package/lib/hotkeys.d.ts +31 -0
- package/lib/hotkeys.d.ts.map +1 -0
- package/lib/hotkeys.js +207 -0
- package/lib/hotkeys.js.map +1 -0
- package/lib/icons.d.ts +90 -0
- package/lib/icons.d.ts.map +1 -0
- package/lib/icons.js +81 -0
- package/lib/icons.js.map +1 -0
- package/lib/image.d.ts +29 -0
- package/lib/image.d.ts.map +1 -0
- package/lib/image.js +140 -0
- package/lib/image.js.map +1 -0
- package/lib/locale.d.ts +37 -0
- package/lib/locale.d.ts.map +1 -0
- package/lib/locale.js +14 -0
- package/lib/locale.js.map +1 -0
- package/lib/number.d.ts +80 -0
- package/lib/number.d.ts.map +1 -0
- package/lib/number.js +144 -0
- package/lib/number.js.map +1 -0
- package/lib/theme.d.ts +67 -0
- package/lib/theme.d.ts.map +1 -0
- package/lib/theme.js +56 -0
- package/lib/theme.js.map +1 -0
- package/lib/time.d.ts +58 -0
- package/lib/time.d.ts.map +1 -0
- package/lib/time.js +225 -0
- package/lib/time.js.map +1 -0
- package/lib/types.d.ts +8 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +17 -0
- package/lib/types.js.map +1 -0
- package/lib/utils.d.ts +37 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +249 -0
- package/lib/utils.js.map +1 -0
- package/locales/en.d.ts +34 -0
- package/locales/en.d.ts.map +1 -0
- package/locales/en.js +33 -0
- package/locales/en.js.map +1 -0
- package/locales/zh.d.ts +4 -0
- package/locales/zh.d.ts.map +1 -0
- package/locales/zh.js +34 -0
- package/locales/zh.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DuoyunModalElement, Options } from './modal';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-drawer
|
|
4
|
+
*/
|
|
5
|
+
export declare class DuoyunDrawerElement extends DuoyunModalElement {
|
|
6
|
+
constructor(options: Options);
|
|
7
|
+
}
|
|
8
|
+
export declare const Drawer: typeof DuoyunDrawerElement;
|
|
9
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../src/elements/drawer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAwBtD;;GAEG;AACH,qBAEa,mBAAoB,SAAQ,kBAAkB;gBAC7C,OAAO,EAAE,OAAO;CAI7B;AAED,eAAO,MAAM,MAAM,4BAAsB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { adoptedStyle, createCSSSheet, css, customElement } from '@mantou/gem';
|
|
8
|
+
import { DuoyunModalElement } from './modal';
|
|
9
|
+
const style = createCSSSheet(css `
|
|
10
|
+
.main {
|
|
11
|
+
padding: 1.2em;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: auto;
|
|
14
|
+
right: 0;
|
|
15
|
+
height: 100%;
|
|
16
|
+
min-width: 30em;
|
|
17
|
+
min-height: none;
|
|
18
|
+
max-height: none;
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
}
|
|
21
|
+
@keyframes showmain {
|
|
22
|
+
0% {
|
|
23
|
+
transform: translate(100%, 0);
|
|
24
|
+
}
|
|
25
|
+
100% {
|
|
26
|
+
transform: translate(0);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
30
|
+
/**
|
|
31
|
+
* @customElement dy-drawer
|
|
32
|
+
*/
|
|
33
|
+
let DuoyunDrawerElement = class DuoyunDrawerElement extends DuoyunModalElement {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
super(options);
|
|
36
|
+
this.addEventListener('mask-click', () => this.close(null));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
DuoyunDrawerElement = __decorate([
|
|
40
|
+
customElement('dy-drawer'),
|
|
41
|
+
adoptedStyle(style)
|
|
42
|
+
], DuoyunDrawerElement);
|
|
43
|
+
export { DuoyunDrawerElement };
|
|
44
|
+
export const Drawer = DuoyunDrawerElement;
|
|
45
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../src/elements/drawer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAW,MAAM,SAAS,CAAC;AAEtD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;CAoB/B,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,kBAAkB;IACzD,YAAY,OAAgB;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;CACF,CAAA;AALY,mBAAmB;IAF/B,aAAa,CAAC,WAAW,CAAC;IAC1B,YAAY,CAAC,KAAK,CAAC;GACP,mBAAmB,CAK/B;SALY,mBAAmB;AAOhC,MAAM,CAAC,MAAM,MAAM,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GemElement, Emitter } from '@mantou/gem';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-drop-area
|
|
4
|
+
*/
|
|
5
|
+
export declare class DuoyunDropAreaElement extends GemElement {
|
|
6
|
+
#private;
|
|
7
|
+
tip: string;
|
|
8
|
+
/**file type */
|
|
9
|
+
accept: string;
|
|
10
|
+
dropeffect: DataTransfer['dropEffect'];
|
|
11
|
+
allowDrop: boolean;
|
|
12
|
+
change: Emitter<File[]>;
|
|
13
|
+
omit: Emitter<File[]>;
|
|
14
|
+
nodata: Emitter<null>;
|
|
15
|
+
constructor();
|
|
16
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=drop-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-area.d.ts","sourceRoot":"","sources":["../src/elements/drop-area.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EASV,OAAO,EACR,MAAM,aAAa,CAAC;AAsCrB;;GAEG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;;IACxC,GAAG,EAAE,MAAM,CAAC;IACvB,eAAe;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAE3C,SAAS,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;;IA4E/B,MAAM,6CAOJ;CACH"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _DuoyunDropAreaElement_instances, _DuoyunDropAreaElement_tip_get, _DuoyunDropAreaElement_accept_get, _DuoyunDropAreaElement_accepts_get, _DuoyunDropAreaElement_dropEffect_get, _DuoyunDropAreaElement_getValidFiles, _DuoyunDropAreaElement_findValidType, _DuoyunDropAreaElement_onDragover, _DuoyunDropAreaElement_onDragleave, _DuoyunDropAreaElement_onDrop;
|
|
13
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, attribute, state, emitter, } from '@mantou/gem';
|
|
14
|
+
import { theme } from '../lib/theme';
|
|
15
|
+
const style = createCSSSheet(css `
|
|
16
|
+
:host {
|
|
17
|
+
display: block;
|
|
18
|
+
position: relative;
|
|
19
|
+
}
|
|
20
|
+
.content,
|
|
21
|
+
.content::before,
|
|
22
|
+
.tip {
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset: 0;
|
|
25
|
+
}
|
|
26
|
+
.content::before {
|
|
27
|
+
content: '';
|
|
28
|
+
background: ${theme.informativeColor};
|
|
29
|
+
opacity: 0.3;
|
|
30
|
+
}
|
|
31
|
+
.content {
|
|
32
|
+
display: none;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
:host(:where(:--allow-drop, [data-allowdrop])) .content {
|
|
36
|
+
display: block;
|
|
37
|
+
}
|
|
38
|
+
.tip {
|
|
39
|
+
display: flex;
|
|
40
|
+
font-size: 0.875em;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
margin: 1em;
|
|
44
|
+
color: white;
|
|
45
|
+
border: 1px dashed currentColor;
|
|
46
|
+
}
|
|
47
|
+
`);
|
|
48
|
+
/**
|
|
49
|
+
* @customElement dy-drop-area
|
|
50
|
+
*/
|
|
51
|
+
let DuoyunDropAreaElement = class DuoyunDropAreaElement extends GemElement {
|
|
52
|
+
constructor() {
|
|
53
|
+
super();
|
|
54
|
+
_DuoyunDropAreaElement_instances.add(this);
|
|
55
|
+
_DuoyunDropAreaElement_getValidFiles.set(this, (types, list) => {
|
|
56
|
+
return types.includes('Files')
|
|
57
|
+
? [...list].filter((file) => __classPrivateFieldGet(this, _DuoyunDropAreaElement_instances, "a", _DuoyunDropAreaElement_accepts_get).some((reg) => reg.test(file.type)))
|
|
58
|
+
: undefined;
|
|
59
|
+
});
|
|
60
|
+
_DuoyunDropAreaElement_findValidType.set(this, (types) => {
|
|
61
|
+
return types.find((type) => __classPrivateFieldGet(this, _DuoyunDropAreaElement_instances, "a", _DuoyunDropAreaElement_accepts_get).some((reg) => reg.test(type)));
|
|
62
|
+
});
|
|
63
|
+
_DuoyunDropAreaElement_onDragover.set(this, (evt) => {
|
|
64
|
+
if (!evt.dataTransfer)
|
|
65
|
+
return;
|
|
66
|
+
const { files, types } = evt.dataTransfer;
|
|
67
|
+
// can't read files
|
|
68
|
+
const isFile = !!__classPrivateFieldGet(this, _DuoyunDropAreaElement_getValidFiles, "f").call(this, types, files);
|
|
69
|
+
const hasValidType = !!__classPrivateFieldGet(this, _DuoyunDropAreaElement_findValidType, "f").call(this, types);
|
|
70
|
+
if (isFile || hasValidType) {
|
|
71
|
+
evt.dataTransfer.dropEffect = __classPrivateFieldGet(this, _DuoyunDropAreaElement_instances, "a", _DuoyunDropAreaElement_dropEffect_get);
|
|
72
|
+
this.allowDrop = true;
|
|
73
|
+
evt.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
_DuoyunDropAreaElement_onDragleave.set(this, () => {
|
|
77
|
+
this.allowDrop = false;
|
|
78
|
+
});
|
|
79
|
+
_DuoyunDropAreaElement_onDrop.set(this, (evt) => {
|
|
80
|
+
evt.preventDefault();
|
|
81
|
+
this.allowDrop = false;
|
|
82
|
+
if (!evt.dataTransfer)
|
|
83
|
+
return;
|
|
84
|
+
const { files, types } = evt.dataTransfer;
|
|
85
|
+
const validFiles = __classPrivateFieldGet(this, _DuoyunDropAreaElement_getValidFiles, "f").call(this, types, files);
|
|
86
|
+
if (validFiles) {
|
|
87
|
+
if (validFiles.length)
|
|
88
|
+
this.change(validFiles);
|
|
89
|
+
const set = new Set(validFiles);
|
|
90
|
+
const omitFiles = [...files].filter((file) => !set.has(file));
|
|
91
|
+
if (omitFiles.length)
|
|
92
|
+
this.omit(omitFiles);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
const type = __classPrivateFieldGet(this, _DuoyunDropAreaElement_findValidType, "f").call(this, evt.dataTransfer.types);
|
|
97
|
+
const string = type && evt.dataTransfer.getData(type);
|
|
98
|
+
if (string) {
|
|
99
|
+
return this.change([new File([string], 'temp', { type: this.accept })]);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
this.nodata(null);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.render = () => {
|
|
107
|
+
return html `
|
|
108
|
+
<slot></slot>
|
|
109
|
+
<div role="tooltip" class="content">
|
|
110
|
+
<div class="tip">${__classPrivateFieldGet(this, _DuoyunDropAreaElement_instances, "a", _DuoyunDropAreaElement_tip_get)}</div>
|
|
111
|
+
</div>
|
|
112
|
+
`;
|
|
113
|
+
};
|
|
114
|
+
this.addEventListener('dragover', __classPrivateFieldGet(this, _DuoyunDropAreaElement_onDragover, "f"));
|
|
115
|
+
this.addEventListener('dragleave', __classPrivateFieldGet(this, _DuoyunDropAreaElement_onDragleave, "f"));
|
|
116
|
+
this.addEventListener('drop', __classPrivateFieldGet(this, _DuoyunDropAreaElement_onDrop, "f"));
|
|
117
|
+
this.internals.role = 'region';
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
_DuoyunDropAreaElement_getValidFiles = new WeakMap(), _DuoyunDropAreaElement_findValidType = new WeakMap(), _DuoyunDropAreaElement_onDragover = new WeakMap(), _DuoyunDropAreaElement_onDragleave = new WeakMap(), _DuoyunDropAreaElement_onDrop = new WeakMap(), _DuoyunDropAreaElement_instances = new WeakSet(), _DuoyunDropAreaElement_tip_get = function _DuoyunDropAreaElement_tip_get() {
|
|
121
|
+
return this.tip || 'Drop zone';
|
|
122
|
+
}, _DuoyunDropAreaElement_accept_get = function _DuoyunDropAreaElement_accept_get() {
|
|
123
|
+
return this.accept || '*';
|
|
124
|
+
}, _DuoyunDropAreaElement_accepts_get = function _DuoyunDropAreaElement_accepts_get() {
|
|
125
|
+
return __classPrivateFieldGet(this, _DuoyunDropAreaElement_instances, "a", _DuoyunDropAreaElement_accept_get).split(',').map((str) => new RegExp(`^${str.trim().replace('*', '.*')}$`));
|
|
126
|
+
}, _DuoyunDropAreaElement_dropEffect_get = function _DuoyunDropAreaElement_dropEffect_get() {
|
|
127
|
+
return this.dropeffect || 'copy';
|
|
128
|
+
};
|
|
129
|
+
__decorate([
|
|
130
|
+
attribute
|
|
131
|
+
], DuoyunDropAreaElement.prototype, "tip", void 0);
|
|
132
|
+
__decorate([
|
|
133
|
+
attribute
|
|
134
|
+
], DuoyunDropAreaElement.prototype, "accept", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
attribute
|
|
137
|
+
], DuoyunDropAreaElement.prototype, "dropeffect", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
state
|
|
140
|
+
], DuoyunDropAreaElement.prototype, "allowDrop", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
emitter
|
|
143
|
+
], DuoyunDropAreaElement.prototype, "change", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
emitter
|
|
146
|
+
], DuoyunDropAreaElement.prototype, "omit", void 0);
|
|
147
|
+
__decorate([
|
|
148
|
+
emitter
|
|
149
|
+
], DuoyunDropAreaElement.prototype, "nodata", void 0);
|
|
150
|
+
DuoyunDropAreaElement = __decorate([
|
|
151
|
+
customElement('dy-drop-area'),
|
|
152
|
+
adoptedStyle(style)
|
|
153
|
+
], DuoyunDropAreaElement);
|
|
154
|
+
export { DuoyunDropAreaElement };
|
|
155
|
+
//# sourceMappingURL=drop-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-area.js","sourceRoot":"","sources":["../src/elements/drop-area.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,SAAS,EACT,KAAK,EACL,OAAO,GAER,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;kBAad,KAAK,CAAC,gBAAgB;;;;;;;;;;;;;;;;;;;CAmBvC,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,UAAU;IA2BnD;QACE,KAAK,EAAE,CAAC;;QAOV,+CAAiB,CAAC,KAAwB,EAAE,IAAc,EAAE,EAAE;YAC5D,OAAO,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC5B,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAA,IAAI,4EAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC9E,CAAC,CAAC,SAAS,CAAC;QAChB,CAAC,EAAC;QAEF,+CAAiB,CAAC,KAAwB,EAAE,EAAE;YAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAA,IAAI,4EAAS,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3E,CAAC,EAAC;QAEF,4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IAGC,OAAO,uBAAA,IAAI,2EAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAChG,CAAC;IAGC,OAAO,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC;AACnC,CAAC;AAxBU;IAAV,SAAS;kDAAa;AAEZ;IAAV,SAAS;qDAAgB;AACf;IAAV,SAAS;yDAAwC;AAE3C;IAAN,KAAK;wDAAoB;AACjB;IAAR,OAAO;qDAAyB;AACxB;IAAR,OAAO;mDAAuB;AACtB;IAAR,OAAO;qDAAuB;AATpB,qBAAqB;IAFjC,aAAa,CAAC,cAAc,CAAC;IAC7B,YAAY,CAAC,KAAK,CAAC;GACP,qBAAqB,CA6FjC;SA7FY,qBAAqB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../src/elements/empty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwE,MAAM,aAAa,CAAC;AAY/G;;GAEG;AACH,qBAGa,kBAAmB,SAAQ,UAAU;IAChD,MAAM,6CAEJ;CACH"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, connectStore } from '@mantou/gem';
|
|
8
|
+
import { locale } from '../lib/locale';
|
|
9
|
+
const style = createCSSSheet(css `
|
|
10
|
+
:host {
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
}
|
|
15
|
+
`);
|
|
16
|
+
/**
|
|
17
|
+
* @customElement dy-empty
|
|
18
|
+
*/
|
|
19
|
+
let DuoyunEmptyElement = class DuoyunEmptyElement extends GemElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
this.render = () => {
|
|
23
|
+
return html `<div>${locale.noData}</div>`;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
DuoyunEmptyElement = __decorate([
|
|
28
|
+
customElement('dy-empty'),
|
|
29
|
+
adoptedStyle(style),
|
|
30
|
+
connectStore(locale)
|
|
31
|
+
], DuoyunEmptyElement);
|
|
32
|
+
export { DuoyunEmptyElement };
|
|
33
|
+
//# sourceMappingURL=empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"empty.js","sourceRoot":"","sources":["../src/elements/empty.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/G,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;CAM/B,CAAC,CAAC;AAEH;;GAEG;AAIH,IAAa,kBAAkB,GAA/B,MAAa,kBAAmB,SAAQ,UAAU;IAAlD;;QACE,WAAM,GAAG,GAAG,EAAE;YACZ,OAAO,IAAI,CAAA,QAAQ,MAAM,CAAC,MAAM,QAAQ,CAAC;QAC3C,CAAC,CAAC;IACJ,CAAC;CAAA,CAAA;AAJY,kBAAkB;IAH9B,aAAa,CAAC,UAAU,CAAC;IACzB,YAAY,CAAC,KAAK,CAAC;IACnB,YAAY,CAAC,MAAM,CAAC;GACR,kBAAkB,CAI9B;SAJY,kBAAkB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GemElement, Emitter, RefObject } from '@mantou/gem';
|
|
2
|
+
import '@mantou/gem/elements/use';
|
|
3
|
+
import './image-preview';
|
|
4
|
+
declare type FileStatus = 'success' | 'fail' | 'uploading';
|
|
5
|
+
export interface FileItem extends File {
|
|
6
|
+
status?: FileStatus;
|
|
7
|
+
message?: string;
|
|
8
|
+
/**0-100 */
|
|
9
|
+
progress?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @customElement dy-file-pick
|
|
13
|
+
*/
|
|
14
|
+
export declare class DuoyunFilePickElement extends GemElement {
|
|
15
|
+
#private;
|
|
16
|
+
type: 'file' | 'image';
|
|
17
|
+
accept: string;
|
|
18
|
+
placeholder: string;
|
|
19
|
+
directory: boolean;
|
|
20
|
+
multiple: boolean;
|
|
21
|
+
change: Emitter<FileItem[]>;
|
|
22
|
+
inputRef: RefObject<HTMLInputElement>;
|
|
23
|
+
value?: FileItem[];
|
|
24
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
25
|
+
openFilePicker: () => void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=file-pick.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-pick.d.ts","sourceRoot":"","sources":["../src/elements/file-pick.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAUV,OAAO,EAEP,SAAS,EAGV,MAAM,aAAa,CAAC;AAQrB,OAAO,0BAA0B,CAAC;AAClC,OAAO,iBAAiB,CAAC;AA8EzB,aAAK,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,WAAW,CAAC;AAEnD,MAAM,WAAW,QAAS,SAAQ,IAAI;IACpC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW;IACX,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;;IACxC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAChC,QAAQ,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAEvC,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IA4E7B,MAAM,6CAyBJ;IAEF,cAAc,aAEZ;CACH"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _DuoyunFilePickElement_instances, _DuoyunFilePickElement_type_get, _DuoyunFilePickElement_accept_get, _DuoyunFilePickElement_placeholder_get, _DuoyunFilePickElement_onChange, _DuoyunFilePickElement_onRemoveItem, _DuoyunFilePickElement_renderFileItem, _DuoyunFilePickElement_renderImageItem;
|
|
13
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, attribute, boolattribute, property, globalemitter, refobject, styleMap, repeat, } from '@mantou/gem';
|
|
14
|
+
import { icons } from '../lib/icons';
|
|
15
|
+
import { theme } from '../lib/theme';
|
|
16
|
+
import { commonHandle } from '../lib/hotkeys';
|
|
17
|
+
import '@mantou/gem/elements/use';
|
|
18
|
+
import './image-preview';
|
|
19
|
+
const style = createCSSSheet(css `
|
|
20
|
+
:host {
|
|
21
|
+
font-size: 0.875em;
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
}
|
|
25
|
+
.list {
|
|
26
|
+
display: contents;
|
|
27
|
+
margin-block-start: 0.5em;
|
|
28
|
+
}
|
|
29
|
+
.item {
|
|
30
|
+
cursor: default;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
gap: 0.5em;
|
|
35
|
+
line-height: 1.2;
|
|
36
|
+
padding: 0.5em;
|
|
37
|
+
border-radius: ${theme.normalRound};
|
|
38
|
+
}
|
|
39
|
+
.list .item:hover {
|
|
40
|
+
background: ${theme.hoverBackgroundColor};
|
|
41
|
+
}
|
|
42
|
+
:host(:not([type='image'])) .list .item:first-of-type {
|
|
43
|
+
margin-block-start: 0.5em;
|
|
44
|
+
}
|
|
45
|
+
.name {
|
|
46
|
+
flex-grow: 1;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
text-overflow: ellipsis;
|
|
50
|
+
}
|
|
51
|
+
.item:not(:hover) .name ~ .icon {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
.icon {
|
|
55
|
+
cursor: pointer;
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
width: 1.2em;
|
|
58
|
+
}
|
|
59
|
+
.button {
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
border-radius: ${theme.normalRound};
|
|
62
|
+
border: 1px dashed ${theme.borderColor};
|
|
63
|
+
}
|
|
64
|
+
.button:hover {
|
|
65
|
+
border-color: ${theme.textColor};
|
|
66
|
+
}
|
|
67
|
+
:host([type='image']) {
|
|
68
|
+
display: grid;
|
|
69
|
+
grid-template-columns: repeat(auto-fill, minmax(5em, 1fr));
|
|
70
|
+
grid-template-rows: max-content;
|
|
71
|
+
grid-gap: 0.8em;
|
|
72
|
+
}
|
|
73
|
+
:host([type='image']) .item {
|
|
74
|
+
border-radius: ${theme.normalRound};
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
}
|
|
77
|
+
:host([type='image']) .item.button {
|
|
78
|
+
order: 999999;
|
|
79
|
+
aspect-ratio: 1;
|
|
80
|
+
padding: 0.5em;
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
flex-direction: column;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
}
|
|
86
|
+
:host([type='image']) .item.button .icon {
|
|
87
|
+
width: 2em;
|
|
88
|
+
}
|
|
89
|
+
:host([type='image']) .item.button .name {
|
|
90
|
+
flex-grow: 0;
|
|
91
|
+
max-width: 100%;
|
|
92
|
+
}
|
|
93
|
+
`);
|
|
94
|
+
/**
|
|
95
|
+
* @customElement dy-file-pick
|
|
96
|
+
*/
|
|
97
|
+
let DuoyunFilePickElement = class DuoyunFilePickElement extends GemElement {
|
|
98
|
+
constructor() {
|
|
99
|
+
super(...arguments);
|
|
100
|
+
_DuoyunFilePickElement_instances.add(this);
|
|
101
|
+
_DuoyunFilePickElement_onChange.set(this, () => {
|
|
102
|
+
const input = this.inputRef.element;
|
|
103
|
+
if (!input.files)
|
|
104
|
+
return;
|
|
105
|
+
this.change([...((this.multiple && this.value) || []), ...input.files]);
|
|
106
|
+
input.value = '';
|
|
107
|
+
});
|
|
108
|
+
_DuoyunFilePickElement_onRemoveItem.set(this, (item) => {
|
|
109
|
+
this.change((this.value || []).filter((e) => e !== item));
|
|
110
|
+
});
|
|
111
|
+
_DuoyunFilePickElement_renderFileItem.set(this, (item) => {
|
|
112
|
+
const { name, status, progress } = item;
|
|
113
|
+
const getColor = () => {
|
|
114
|
+
switch (status) {
|
|
115
|
+
case 'success':
|
|
116
|
+
return theme.positiveColor;
|
|
117
|
+
case 'fail':
|
|
118
|
+
return theme.negativeColor;
|
|
119
|
+
default:
|
|
120
|
+
return theme.textColor;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return html `
|
|
124
|
+
<div role="listitem" class="item" style=${styleMap({ color: getColor() })}>
|
|
125
|
+
<div class="name">${name}</div>
|
|
126
|
+
${progress ? html `<div role="progressbar">${Math.floor(progress)}%</div>` : ''}
|
|
127
|
+
<gem-use
|
|
128
|
+
role="button"
|
|
129
|
+
tabindex="0"
|
|
130
|
+
@keydown=${commonHandle}
|
|
131
|
+
class="icon"
|
|
132
|
+
.element=${icons.delete}
|
|
133
|
+
@click=${() => __classPrivateFieldGet(this, _DuoyunFilePickElement_onRemoveItem, "f").call(this, item)}
|
|
134
|
+
></gem-use>
|
|
135
|
+
</div>
|
|
136
|
+
`;
|
|
137
|
+
});
|
|
138
|
+
_DuoyunFilePickElement_renderImageItem.set(this, (item) => {
|
|
139
|
+
const getStatus = () => {
|
|
140
|
+
switch (item.status) {
|
|
141
|
+
case 'success':
|
|
142
|
+
return 'positive';
|
|
143
|
+
case 'fail':
|
|
144
|
+
return 'negative';
|
|
145
|
+
default:
|
|
146
|
+
return 'detault';
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return html `
|
|
150
|
+
<dy-image-preview
|
|
151
|
+
role="listitem"
|
|
152
|
+
class="item"
|
|
153
|
+
.status=${getStatus()}
|
|
154
|
+
.progress=${item.progress || 0}
|
|
155
|
+
.file=${item}
|
|
156
|
+
.actions=${[{ icon: icons.delete, handle: () => __classPrivateFieldGet(this, _DuoyunFilePickElement_onRemoveItem, "f").call(this, item) }]}
|
|
157
|
+
></dy-image-preview>
|
|
158
|
+
`;
|
|
159
|
+
});
|
|
160
|
+
this.render = () => {
|
|
161
|
+
const renderItem = __classPrivateFieldGet(this, _DuoyunFilePickElement_instances, "a", _DuoyunFilePickElement_type_get) === 'file' ? __classPrivateFieldGet(this, _DuoyunFilePickElement_renderFileItem, "f") : __classPrivateFieldGet(this, _DuoyunFilePickElement_renderImageItem, "f");
|
|
162
|
+
return html `
|
|
163
|
+
<input
|
|
164
|
+
hidden
|
|
165
|
+
type="file"
|
|
166
|
+
?multiple=${this.multiple}
|
|
167
|
+
ref=${this.inputRef.ref}
|
|
168
|
+
@change=${__classPrivateFieldGet(this, _DuoyunFilePickElement_onChange, "f")}
|
|
169
|
+
.webkitdirectory=${this.directory}
|
|
170
|
+
accept=${__classPrivateFieldGet(this, _DuoyunFilePickElement_instances, "a", _DuoyunFilePickElement_accept_get)}>
|
|
171
|
+
</input>
|
|
172
|
+
<div
|
|
173
|
+
tabindex="0"
|
|
174
|
+
role="button"
|
|
175
|
+
part="button"
|
|
176
|
+
class="item button"
|
|
177
|
+
@keydown=${commonHandle}
|
|
178
|
+
@click=${() => this.openFilePicker()}>
|
|
179
|
+
<gem-use class="icon" .element=${icons.add}></gem-use>
|
|
180
|
+
<span class="name">${__classPrivateFieldGet(this, _DuoyunFilePickElement_instances, "a", _DuoyunFilePickElement_placeholder_get)}</span>
|
|
181
|
+
</div>
|
|
182
|
+
${this.value ? html `<div role="list" class="list">${repeat(this.value, (e) => e, renderItem)}</div>` : ''}
|
|
183
|
+
`;
|
|
184
|
+
};
|
|
185
|
+
this.openFilePicker = () => {
|
|
186
|
+
this.inputRef.element.click();
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
_DuoyunFilePickElement_onChange = new WeakMap(), _DuoyunFilePickElement_onRemoveItem = new WeakMap(), _DuoyunFilePickElement_renderFileItem = new WeakMap(), _DuoyunFilePickElement_renderImageItem = new WeakMap(), _DuoyunFilePickElement_instances = new WeakSet(), _DuoyunFilePickElement_type_get = function _DuoyunFilePickElement_type_get() {
|
|
191
|
+
return this.type || 'file';
|
|
192
|
+
}, _DuoyunFilePickElement_accept_get = function _DuoyunFilePickElement_accept_get() {
|
|
193
|
+
return this.accept || (__classPrivateFieldGet(this, _DuoyunFilePickElement_instances, "a", _DuoyunFilePickElement_type_get) === 'image' ? 'image/*' : '*');
|
|
194
|
+
}, _DuoyunFilePickElement_placeholder_get = function _DuoyunFilePickElement_placeholder_get() {
|
|
195
|
+
return this.placeholder || 'Browse';
|
|
196
|
+
};
|
|
197
|
+
__decorate([
|
|
198
|
+
attribute
|
|
199
|
+
], DuoyunFilePickElement.prototype, "type", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
attribute
|
|
202
|
+
], DuoyunFilePickElement.prototype, "accept", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
attribute
|
|
205
|
+
], DuoyunFilePickElement.prototype, "placeholder", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
boolattribute
|
|
208
|
+
], DuoyunFilePickElement.prototype, "directory", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
boolattribute
|
|
211
|
+
], DuoyunFilePickElement.prototype, "multiple", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
globalemitter
|
|
214
|
+
], DuoyunFilePickElement.prototype, "change", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
refobject
|
|
217
|
+
], DuoyunFilePickElement.prototype, "inputRef", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
property
|
|
220
|
+
], DuoyunFilePickElement.prototype, "value", void 0);
|
|
221
|
+
DuoyunFilePickElement = __decorate([
|
|
222
|
+
customElement('dy-file-pick'),
|
|
223
|
+
adoptedStyle(style)
|
|
224
|
+
], DuoyunFilePickElement);
|
|
225
|
+
export { DuoyunFilePickElement };
|
|
226
|
+
//# sourceMappingURL=file-pick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-pick.js","sourceRoot":"","sources":["../src/elements/file-pick.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,SAAS,EACT,aAAa,EACb,QAAQ,EACR,aAAa,EAEb,SAAS,EAET,QAAQ,EACR,MAAM,GACP,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C,OAAO,0BAA0B,CAAC;AAClC,OAAO,iBAAiB,CAAC;AAEzB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;qBAkBX,KAAK,CAAC,WAAW;;;kBAGpB,KAAK,CAAC,oBAAoB;;;;;;;;;;;;;;;;;;;;;qBAqBvB,KAAK,CAAC,WAAW;yBACb,KAAK,CAAC,WAAW;;;oBAGtB,KAAK,CAAC,SAAS;;;;;;;;;qBASd,KAAK,CAAC,WAAW;;;;;;;;;;;;;;;;;;;CAmBrC,CAAC,CAAC;AAWH;;GAEG;AAGH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,UAAU;IAArD;;;QAuBE,0CAAY,GAAG,EAAE;YACf,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAQ,CAAC;YACrC,IAAI,CAAC,KAAK,CAAC,KAAK;gBAAE,OAAO;YACzB,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,CAA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,IAAI,CAAC,uBAAA,IAAI,yEAAM,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;IAGC,OAAO,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC;AACtC,CAAC;AApBU;IAAV,SAAS;mDAAwB;AACvB;IAAV,SAAS;qDAAgB;AACf;IAAV,SAAS;0DAAqB;AAChB;IAAd,aAAa;wDAAoB;AACnB;IAAd,aAAa;uDAAmB;AAClB;IAAd,aAAa;qDAA6B;AAChC;IAAV,SAAS;uDAAuC;AAEvC;IAAT,QAAQ;oDAAoB;AATlB,qBAAqB;IAFjC,aAAa,CAAC,cAAc,CAAC;IAC7B,YAAY,CAAC,KAAK,CAAC;GACP,qBAAqB,CAmHjC;SAnHY,qBAAqB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GemElement, RefObject, TemplateResult } from '@mantou/gem';
|
|
2
|
+
import type { DataList } from './input';
|
|
3
|
+
import type { Option } from './pick';
|
|
4
|
+
import type { Option as SelectOption } from './select';
|
|
5
|
+
import './input';
|
|
6
|
+
import './pick';
|
|
7
|
+
import './button';
|
|
8
|
+
import './checkbox';
|
|
9
|
+
import './radio';
|
|
10
|
+
import './select';
|
|
11
|
+
import './help-text';
|
|
12
|
+
/**
|
|
13
|
+
* @customElement dy-form
|
|
14
|
+
*/
|
|
15
|
+
export declare class DuoyunFormElement<Data = Record<string, any>> extends GemElement {
|
|
16
|
+
get items(): DuoyunFormItemElement[];
|
|
17
|
+
get data(): Data;
|
|
18
|
+
constructor();
|
|
19
|
+
valid(): Promise<boolean>;
|
|
20
|
+
clearInvalidMessage(): void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @customElement dy-form-item-inline-group
|
|
24
|
+
*/
|
|
25
|
+
export declare class DuoyunFormItemInlineGroupElement extends GemElement {
|
|
26
|
+
constructor();
|
|
27
|
+
}
|
|
28
|
+
declare type FormItemState = {
|
|
29
|
+
value?: number | string | any[];
|
|
30
|
+
checked?: boolean;
|
|
31
|
+
invalidMessage?: string;
|
|
32
|
+
};
|
|
33
|
+
declare type FormItemRule = {
|
|
34
|
+
message?: string;
|
|
35
|
+
pattern?: string;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
validator?: (value: any) => Promise<void>;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @customElement dy-form-item
|
|
41
|
+
* @attr type
|
|
42
|
+
* @attr multiple
|
|
43
|
+
* @attr name
|
|
44
|
+
* @attr label
|
|
45
|
+
* @attr placeholder
|
|
46
|
+
* @attr required
|
|
47
|
+
* @attr checked
|
|
48
|
+
* @attr disabled
|
|
49
|
+
* @attr searchable
|
|
50
|
+
*/
|
|
51
|
+
export declare class DuoyunFormItemElement extends GemElement<FormItemState> {
|
|
52
|
+
#private;
|
|
53
|
+
type: 'text' | 'number' | 'checkbox' | 'pick' | 'radio' | 'select' | 'textarea' | 'slot';
|
|
54
|
+
multiple: boolean;
|
|
55
|
+
name: string;
|
|
56
|
+
label: string;
|
|
57
|
+
placeholder: string;
|
|
58
|
+
required: boolean;
|
|
59
|
+
checked: boolean;
|
|
60
|
+
disabled: boolean;
|
|
61
|
+
searchable: boolean;
|
|
62
|
+
invalid: boolean;
|
|
63
|
+
value?: number | string | any[] | any;
|
|
64
|
+
renderLabel: (e: SelectOption) => string | TemplateResult;
|
|
65
|
+
rules?: FormItemRule[];
|
|
66
|
+
dataList?: DataList | Option[];
|
|
67
|
+
slotRef: RefObject<HTMLSlotElement>;
|
|
68
|
+
state: FormItemState;
|
|
69
|
+
get data(): string | number | boolean | any[] | undefined;
|
|
70
|
+
mounted: () => void;
|
|
71
|
+
render: () => TemplateResult;
|
|
72
|
+
clearInvalidMessage(): void;
|
|
73
|
+
valid(): Promise<boolean>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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