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,54 @@
|
|
|
1
|
+
import { GemElement, TemplateResult, RefObject, Emitter } from '@mantou/gem';
|
|
2
|
+
import '@mantou/gem/elements/reflect';
|
|
3
|
+
export declare type PopoverState = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
left: number;
|
|
6
|
+
right: number;
|
|
7
|
+
top: number;
|
|
8
|
+
bottom: number;
|
|
9
|
+
style: Partial<CSSStyleDeclaration>;
|
|
10
|
+
position: Position;
|
|
11
|
+
};
|
|
12
|
+
declare type Position = 'top' | 'bottom' | 'right' | 'left';
|
|
13
|
+
declare type GhostStyle = {
|
|
14
|
+
'--bg': string;
|
|
15
|
+
'--color': string;
|
|
16
|
+
};
|
|
17
|
+
declare type Option = {
|
|
18
|
+
delay?: number;
|
|
19
|
+
content?: string | TemplateResult;
|
|
20
|
+
position?: Position;
|
|
21
|
+
ghostStyle?: GhostStyle;
|
|
22
|
+
trigger?: 'click' | 'hover';
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @customElement dy-popover
|
|
26
|
+
* @attr debug
|
|
27
|
+
* @attr position
|
|
28
|
+
* @attr trigger
|
|
29
|
+
*/
|
|
30
|
+
export declare class DuoyunPopoverElement extends GemElement<PopoverState> {
|
|
31
|
+
#private;
|
|
32
|
+
debug: boolean;
|
|
33
|
+
trigger: 'click' | 'hover';
|
|
34
|
+
position: Position | 'auto';
|
|
35
|
+
content?: string | TemplateResult;
|
|
36
|
+
wrapRef: RefObject<HTMLDivElement>;
|
|
37
|
+
slotRef: RefObject<HTMLSlotElement>;
|
|
38
|
+
open: Emitter<null>;
|
|
39
|
+
close: Emitter<null>;
|
|
40
|
+
static show: (x: number, y: number, option: Option) => () => void;
|
|
41
|
+
ghostStyle: GhostStyle;
|
|
42
|
+
state: PopoverState;
|
|
43
|
+
constructor({ delay, content, position, ghostStyle, trigger }?: Option);
|
|
44
|
+
mounted: () => void;
|
|
45
|
+
render: () => TemplateResult;
|
|
46
|
+
}
|
|
47
|
+
export declare const Popover: typeof DuoyunPopoverElement;
|
|
48
|
+
/**
|
|
49
|
+
* @customElement dy-popover-ghost
|
|
50
|
+
*/
|
|
51
|
+
export declare class DuoyunPopoverGhostElement extends GemElement {
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=popover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../src/elements/popover.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAMV,cAAc,EAGd,SAAS,EAKT,OAAO,EACR,MAAM,aAAa,CAAC;AAKrB,OAAO,8BAA8B,CAAC;AAQtC,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK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C;AAoD5C;;GAEG;AACH,qBAEa,yBAA0B,SAAQ,UAAU;CAAG"}
|
|
@@ -0,0 +1,316 @@
|
|
|
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
13
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
14
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
15
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
16
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
17
|
+
};
|
|
18
|
+
var _DuoyunPopoverElement_instances, _DuoyunPopoverElement_position_get, _DuoyunPopoverElement_trigger_get, _DuoyunPopoverElement_hover, _DuoyunPopoverElement_open, _DuoyunPopoverElement_close, _DuoyunPopoverElement_genStyle;
|
|
19
|
+
var DuoyunPopoverElement_1;
|
|
20
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, property, refobject, attribute, styleMap, boolattribute, emitter, } from '@mantou/gem';
|
|
21
|
+
import { sleep, setBodyInert } from '../lib/utils';
|
|
22
|
+
import { theme } from '../lib/theme';
|
|
23
|
+
import '@mantou/gem/elements/reflect';
|
|
24
|
+
const style = createCSSSheet(css `
|
|
25
|
+
:host {
|
|
26
|
+
display: contents;
|
|
27
|
+
}
|
|
28
|
+
`);
|
|
29
|
+
const getAssignedElements = (ele) => {
|
|
30
|
+
const es = ele.assignedElements();
|
|
31
|
+
if (es[0] instanceof HTMLSlotElement) {
|
|
32
|
+
return getAssignedElements(es[0]);
|
|
33
|
+
}
|
|
34
|
+
return es;
|
|
35
|
+
};
|
|
36
|
+
const getBoundingClientRect = (eles) => {
|
|
37
|
+
const rects = eles.map((e) => e.getBoundingClientRect());
|
|
38
|
+
return {
|
|
39
|
+
top: Math.min(...rects.map((e) => e.top)),
|
|
40
|
+
left: Math.min(...rects.map((e) => e.left)),
|
|
41
|
+
right: Math.max(...rects.map((e) => e.right)),
|
|
42
|
+
bottom: Math.max(...rects.map((e) => e.bottom)),
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* @customElement dy-popover
|
|
47
|
+
* @attr debug
|
|
48
|
+
* @attr position
|
|
49
|
+
* @attr trigger
|
|
50
|
+
*/
|
|
51
|
+
let DuoyunPopoverElement = DuoyunPopoverElement_1 = class DuoyunPopoverElement extends GemElement {
|
|
52
|
+
constructor({ delay = 500, content, position, ghostStyle, trigger } = {}) {
|
|
53
|
+
super();
|
|
54
|
+
_DuoyunPopoverElement_instances.add(this);
|
|
55
|
+
this.ghostStyle = {
|
|
56
|
+
'--bg': theme.backgroundColor,
|
|
57
|
+
'--color': theme.highlightColor,
|
|
58
|
+
};
|
|
59
|
+
this.state = {
|
|
60
|
+
open: false,
|
|
61
|
+
top: 0,
|
|
62
|
+
left: 0,
|
|
63
|
+
right: 0,
|
|
64
|
+
bottom: 0,
|
|
65
|
+
style: {},
|
|
66
|
+
position: 'top',
|
|
67
|
+
};
|
|
68
|
+
_DuoyunPopoverElement_hover.set(this, false);
|
|
69
|
+
_DuoyunPopoverElement_open.set(this, (targetRect) => {
|
|
70
|
+
if (this.state.open)
|
|
71
|
+
return;
|
|
72
|
+
let rect = targetRect;
|
|
73
|
+
if (!rect) {
|
|
74
|
+
let eles = getAssignedElements(this.slotRef.element);
|
|
75
|
+
if (!eles.length) {
|
|
76
|
+
eles = [this];
|
|
77
|
+
this.style.display = 'inline';
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.removeAttribute('style');
|
|
81
|
+
}
|
|
82
|
+
rect = getBoundingClientRect(eles);
|
|
83
|
+
}
|
|
84
|
+
this.open(null);
|
|
85
|
+
const { top, right, bottom, left } = rect;
|
|
86
|
+
this.setState({
|
|
87
|
+
open: true,
|
|
88
|
+
top,
|
|
89
|
+
left,
|
|
90
|
+
right,
|
|
91
|
+
bottom,
|
|
92
|
+
});
|
|
93
|
+
const position = __classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_position_get) === 'auto' ? 'top' : __classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_position_get);
|
|
94
|
+
this.setState({
|
|
95
|
+
position,
|
|
96
|
+
style: __classPrivateFieldGet(this, _DuoyunPopoverElement_genStyle, "f").call(this, position),
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
_DuoyunPopoverElement_close.set(this, () => {
|
|
100
|
+
this.close(null);
|
|
101
|
+
this.setState({ open: this.debug || false });
|
|
102
|
+
__classPrivateFieldSet(this, _DuoyunPopoverElement_hover, false, "f");
|
|
103
|
+
});
|
|
104
|
+
_DuoyunPopoverElement_genStyle.set(this, (position) => {
|
|
105
|
+
const { top, left, right, bottom } = this.state;
|
|
106
|
+
const offset = 12;
|
|
107
|
+
switch (position) {
|
|
108
|
+
case 'top':
|
|
109
|
+
return {
|
|
110
|
+
left: `${left + (right - left) / 2}px`,
|
|
111
|
+
bottom: `${innerHeight - top + offset}px`,
|
|
112
|
+
transform: `translateX(-50%)`,
|
|
113
|
+
};
|
|
114
|
+
case 'bottom':
|
|
115
|
+
return {
|
|
116
|
+
left: `${left + (right - left) / 2}px`,
|
|
117
|
+
top: `${bottom + offset}px`,
|
|
118
|
+
transform: `translateX(-50%)`,
|
|
119
|
+
};
|
|
120
|
+
case 'left':
|
|
121
|
+
return {
|
|
122
|
+
right: `${innerWidth - left + offset}px`,
|
|
123
|
+
top: `${top + (bottom - top) / 2}px`,
|
|
124
|
+
transform: `translateY(-50%)`,
|
|
125
|
+
};
|
|
126
|
+
case 'right':
|
|
127
|
+
return {
|
|
128
|
+
left: `${right + offset}px`,
|
|
129
|
+
top: `${top + (bottom - top) / 2}px`,
|
|
130
|
+
transform: `translateY(-50%)`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
this.mounted = () => {
|
|
135
|
+
this.effect(() => {
|
|
136
|
+
if (this.state.open && __classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_position_get) === 'auto') {
|
|
137
|
+
const { top, left, right } = this.wrapRef.element.getBoundingClientRect();
|
|
138
|
+
let position = 'top';
|
|
139
|
+
if (right > innerWidth) {
|
|
140
|
+
position = 'left';
|
|
141
|
+
}
|
|
142
|
+
else if (top < 0) {
|
|
143
|
+
position = 'bottom';
|
|
144
|
+
}
|
|
145
|
+
else if (left < 0) {
|
|
146
|
+
position = 'right';
|
|
147
|
+
}
|
|
148
|
+
this.setState({ style: __classPrivateFieldGet(this, _DuoyunPopoverElement_genStyle, "f").call(this, position), position });
|
|
149
|
+
}
|
|
150
|
+
}, () => [this.state.open]);
|
|
151
|
+
};
|
|
152
|
+
this.render = () => {
|
|
153
|
+
const { open, style, position } = this.state;
|
|
154
|
+
return html `
|
|
155
|
+
${open
|
|
156
|
+
? html `
|
|
157
|
+
<gem-reflect .target=${document.body}>
|
|
158
|
+
<div
|
|
159
|
+
style=${styleMap({
|
|
160
|
+
display: this.trigger === 'click' ? 'block' : 'none',
|
|
161
|
+
position: 'absolute',
|
|
162
|
+
inset: '0',
|
|
163
|
+
})}
|
|
164
|
+
@click=${__classPrivateFieldGet(this, _DuoyunPopoverElement_close, "f")}
|
|
165
|
+
></div>
|
|
166
|
+
<dy-popover-ghost
|
|
167
|
+
role=${this.tagName.includes('TOOLTIP') ? 'tooltip' : 'region'}
|
|
168
|
+
ref=${this.wrapRef.ref}
|
|
169
|
+
data-position=${position}
|
|
170
|
+
style=${`${styleMap(style)}${styleMap(this.ghostStyle)}`}
|
|
171
|
+
>
|
|
172
|
+
${this.content}
|
|
173
|
+
</dy-popover-ghost>
|
|
174
|
+
</gem-reflect>
|
|
175
|
+
`
|
|
176
|
+
: ''}
|
|
177
|
+
<slot ref=${this.slotRef.ref}></slot>
|
|
178
|
+
`;
|
|
179
|
+
};
|
|
180
|
+
if (content)
|
|
181
|
+
this.content = content;
|
|
182
|
+
if (position)
|
|
183
|
+
this.position = position;
|
|
184
|
+
if (ghostStyle)
|
|
185
|
+
this.ghostStyle = ghostStyle;
|
|
186
|
+
if (trigger)
|
|
187
|
+
this.trigger = trigger;
|
|
188
|
+
this.addEventListener('mouseover', async () => {
|
|
189
|
+
if (__classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_trigger_get) === 'click')
|
|
190
|
+
return;
|
|
191
|
+
__classPrivateFieldSet(this, _DuoyunPopoverElement_hover, true, "f");
|
|
192
|
+
await sleep(delay);
|
|
193
|
+
if (!this.content)
|
|
194
|
+
return;
|
|
195
|
+
if (!__classPrivateFieldGet(this, _DuoyunPopoverElement_hover, "f"))
|
|
196
|
+
return;
|
|
197
|
+
__classPrivateFieldGet(this, _DuoyunPopoverElement_open, "f").call(this);
|
|
198
|
+
});
|
|
199
|
+
this.addEventListener('mouseout', () => {
|
|
200
|
+
if (__classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_trigger_get) === 'click')
|
|
201
|
+
return;
|
|
202
|
+
__classPrivateFieldGet(this, _DuoyunPopoverElement_close, "f").call(this);
|
|
203
|
+
});
|
|
204
|
+
this.addEventListener('click', () => {
|
|
205
|
+
if (__classPrivateFieldGet(this, _DuoyunPopoverElement_instances, "a", _DuoyunPopoverElement_trigger_get) === 'hover')
|
|
206
|
+
return;
|
|
207
|
+
__classPrivateFieldGet(this, _DuoyunPopoverElement_open, "f").call(this);
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
_DuoyunPopoverElement_hover = new WeakMap(), _DuoyunPopoverElement_open = new WeakMap(), _DuoyunPopoverElement_close = new WeakMap(), _DuoyunPopoverElement_genStyle = new WeakMap(), _DuoyunPopoverElement_instances = new WeakSet(), _DuoyunPopoverElement_position_get = function _DuoyunPopoverElement_position_get() {
|
|
212
|
+
return this.position || 'auto';
|
|
213
|
+
}, _DuoyunPopoverElement_trigger_get = function _DuoyunPopoverElement_trigger_get() {
|
|
214
|
+
return this.trigger || 'hover';
|
|
215
|
+
};
|
|
216
|
+
DuoyunPopoverElement.show = (x, y, option) => {
|
|
217
|
+
const popover = new DuoyunPopoverElement_1(option);
|
|
218
|
+
const restoreInert = option.trigger === 'click' ? setBodyInert(popover) : undefined;
|
|
219
|
+
document.body.append(popover);
|
|
220
|
+
__classPrivateFieldGet(popover, _DuoyunPopoverElement_open, "f").call(popover, { left: x, right: x, top: y, bottom: y });
|
|
221
|
+
return () => {
|
|
222
|
+
restoreInert === null || restoreInert === void 0 ? void 0 : restoreInert();
|
|
223
|
+
popover.close(null);
|
|
224
|
+
popover.remove();
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
__decorate([
|
|
228
|
+
boolattribute
|
|
229
|
+
], DuoyunPopoverElement.prototype, "debug", void 0);
|
|
230
|
+
__decorate([
|
|
231
|
+
attribute
|
|
232
|
+
], DuoyunPopoverElement.prototype, "trigger", void 0);
|
|
233
|
+
__decorate([
|
|
234
|
+
attribute
|
|
235
|
+
], DuoyunPopoverElement.prototype, "position", void 0);
|
|
236
|
+
__decorate([
|
|
237
|
+
property
|
|
238
|
+
], DuoyunPopoverElement.prototype, "content", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
refobject
|
|
241
|
+
], DuoyunPopoverElement.prototype, "wrapRef", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
refobject
|
|
244
|
+
], DuoyunPopoverElement.prototype, "slotRef", void 0);
|
|
245
|
+
__decorate([
|
|
246
|
+
emitter
|
|
247
|
+
], DuoyunPopoverElement.prototype, "open", void 0);
|
|
248
|
+
__decorate([
|
|
249
|
+
emitter
|
|
250
|
+
], DuoyunPopoverElement.prototype, "close", void 0);
|
|
251
|
+
DuoyunPopoverElement = DuoyunPopoverElement_1 = __decorate([
|
|
252
|
+
customElement('dy-popover'),
|
|
253
|
+
adoptedStyle(style)
|
|
254
|
+
], DuoyunPopoverElement);
|
|
255
|
+
export { DuoyunPopoverElement };
|
|
256
|
+
export const Popover = DuoyunPopoverElement;
|
|
257
|
+
const ghostStyle = createCSSSheet(css `
|
|
258
|
+
:host {
|
|
259
|
+
position: fixed;
|
|
260
|
+
z-index: 9999999;
|
|
261
|
+
background-color: var(--bg);
|
|
262
|
+
color: var(--color);
|
|
263
|
+
line-height: 1.5;
|
|
264
|
+
padding: 0.6em 1em;
|
|
265
|
+
border-radius: ${theme.normalRound};
|
|
266
|
+
font-size: 0.875em;
|
|
267
|
+
hyphens: auto;
|
|
268
|
+
-moz-osx-font-smoothing: grayscale;
|
|
269
|
+
-webkit-font-smoothing: antialiased;
|
|
270
|
+
filter: drop-shadow(rgba(0, 0, 0, calc(${theme.maskAlpha})) 0px 0.6em 1em);
|
|
271
|
+
}
|
|
272
|
+
:host::before {
|
|
273
|
+
content: '';
|
|
274
|
+
position: absolute;
|
|
275
|
+
border-style: solid;
|
|
276
|
+
}
|
|
277
|
+
:host([data-position='top'])::before {
|
|
278
|
+
top: 100%;
|
|
279
|
+
left: 50%;
|
|
280
|
+
border-color: var(--bg) transparent transparent transparent;
|
|
281
|
+
border-width: 6px 6px 0 6px;
|
|
282
|
+
transform: translateX(-50%);
|
|
283
|
+
}
|
|
284
|
+
:host([data-position='bottom'])::before {
|
|
285
|
+
bottom: 100%;
|
|
286
|
+
left: 50%;
|
|
287
|
+
border-color: transparent transparent var(--bg) transparent;
|
|
288
|
+
border-width: 0 6px 6px 6px;
|
|
289
|
+
transform: translateX(-50%);
|
|
290
|
+
}
|
|
291
|
+
:host([data-position='left'])::before {
|
|
292
|
+
top: 50%;
|
|
293
|
+
left: 100%;
|
|
294
|
+
border-color: transparent transparent transparent var(--bg);
|
|
295
|
+
border-width: 6px 0 6px 6px;
|
|
296
|
+
transform: translateY(-50%);
|
|
297
|
+
}
|
|
298
|
+
:host([data-position='right'])::before {
|
|
299
|
+
top: 50%;
|
|
300
|
+
right: 100%;
|
|
301
|
+
border-color: transparent var(--bg) transparent transparent;
|
|
302
|
+
border-width: 6px 6px 6px 0;
|
|
303
|
+
transform: translateY(-50%);
|
|
304
|
+
}
|
|
305
|
+
`);
|
|
306
|
+
/**
|
|
307
|
+
* @customElement dy-popover-ghost
|
|
308
|
+
*/
|
|
309
|
+
let DuoyunPopoverGhostElement = class DuoyunPopoverGhostElement extends GemElement {
|
|
310
|
+
};
|
|
311
|
+
DuoyunPopoverGhostElement = __decorate([
|
|
312
|
+
customElement('dy-popover-ghost'),
|
|
313
|
+
adoptedStyle(ghostStyle)
|
|
314
|
+
], DuoyunPopoverGhostElement);
|
|
315
|
+
export { DuoyunPopoverGhostElement };
|
|
316
|
+
//# sourceMappingURL=popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"","sources":["../src/elements/popover.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,UAAU,EACV,IAAI,EAC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AAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;IACxD,OAAO,GAAG,EAAE;QACV,YAAY,aAAZ,YAAY,uBAAZ,YAAY,EAAI,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC,CAAC;AACJ,CAAE,CAAA;AArBa;IAAd,aAAa;mDAAgB;AACnB;IAAV,SAAS;qDAA4B;AAC3B;IAAV,SAAS;sDAA6B;AAE7B;IAAT,QAAQ;qDAAmC;AAEjC;IAAV,SAAS;qDAAoC;AACnC;IAAV,SAAS;qDAAqC;AACtC;IAAR,OAAO;kDAAqB;AACpB;IAAR,OAAO;mDAAsB;AAVnB,oBAAoB;IAFhC,aAAa,CAAC,YAAY,CAAC;IAC3B,YAAY,CAAC,KAAK,CAAC;GACP,oBAAoB,CA6LhC;SA7LY,oBAAoB;AA+LjC,MAAM,CAAC,MAAM,OAAO,GAAG,oBAAoB,CAAC;AAE5C,MAAM,UAAU,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;qBAQhB,KAAK,CAAC,WAAW;;;;;6CAKO,KAAK,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmC3D,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,yBAAyB,GAAtC,MAAa,yBAA0B,SAAQ,UAAU;CAAG,CAAA;AAA/C,yBAAyB;IAFrC,aAAa,CAAC,kBAAkB,CAAC;IACjC,YAAY,CAAC,UAAU,CAAC;GACZ,yBAAyB,CAAsB;SAA/C,yBAAyB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DuoyunMeterElement } from './meter';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-progress
|
|
4
|
+
*/
|
|
5
|
+
export declare class DuoyunProgressElement extends DuoyunMeterElement {
|
|
6
|
+
#private;
|
|
7
|
+
/**ms */
|
|
8
|
+
estimate: number;
|
|
9
|
+
constructor();
|
|
10
|
+
calculateColor: () => string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../src/elements/progress.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AACH,qBACa,qBAAsB,SAAQ,kBAAkB;;IAC3D,QAAQ;IACM,QAAQ,EAAE,MAAM,CAAC;;IAiB/B,cAAc,eAEZ;CACH"}
|
|
@@ -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
|
+
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 _DuoyunProgressElement_setNextValue;
|
|
13
|
+
import { customElement, numattribute } from '@mantou/gem';
|
|
14
|
+
import { theme } from '../lib/theme';
|
|
15
|
+
import { DuoyunMeterElement } from './meter';
|
|
16
|
+
/**
|
|
17
|
+
* @customElement dy-progress
|
|
18
|
+
*/
|
|
19
|
+
let DuoyunProgressElement = class DuoyunProgressElement extends DuoyunMeterElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
_DuoyunProgressElement_setNextValue.set(this, () => {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
if (this.estimate) {
|
|
25
|
+
this.value += (99 - this.value) * (300 / this.estimate);
|
|
26
|
+
__classPrivateFieldGet(this, _DuoyunProgressElement_setNextValue, "f").call(this);
|
|
27
|
+
}
|
|
28
|
+
}, 100);
|
|
29
|
+
});
|
|
30
|
+
this.calculateColor = () => {
|
|
31
|
+
return theme.informativeColor;
|
|
32
|
+
};
|
|
33
|
+
__classPrivateFieldGet(this, _DuoyunProgressElement_setNextValue, "f").call(this);
|
|
34
|
+
this.internals.role = 'progressbar';
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
_DuoyunProgressElement_setNextValue = new WeakMap();
|
|
38
|
+
__decorate([
|
|
39
|
+
numattribute
|
|
40
|
+
], DuoyunProgressElement.prototype, "estimate", void 0);
|
|
41
|
+
DuoyunProgressElement = __decorate([
|
|
42
|
+
customElement('dy-progress')
|
|
43
|
+
], DuoyunProgressElement);
|
|
44
|
+
export { DuoyunProgressElement };
|
|
45
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../src/elements/progress.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;GAEG;AAEH,IAAa,qBAAqB,GAAlC,MAAa,qBAAsB,SAAQ,kBAAkB;IAI3D;QACE,KAAK,EAAE,CAAC;QAKV,8CAAgB,GAAG,EAAE;YACnB,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,IAAI,CAAC,QAAQ,EAAE;oBACjB,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;oBACxD,uBAAA,IAAI,2CAAc,MAAlB,IAAI,CAAgB,CAAC;iBACtB;YACH,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC,EAAC;QAEF,mBAAc,GAAG,GAAG,EAAE;YACpB,OAAO,KAAK,CAAC,gBAAgB,CAAC;QAChC,CAAC,CAAC;QAfA,uBAAA,IAAI,2CAAc,MAAlB,IAAI,CAAgB,CAAC;QACrB,IAAI,CAAC,SAAS,CAAC,IAAI,GAAG,aAAa,CAAC;IACtC,CAAC;CAcF,CAAA;;AApBe;IAAb,YAAY;uDAAkB;AAFpB,qBAAqB;IADjC,aAAa,CAAC,aAAa,CAAC;GAChB,qBAAqB,CAsBjC;SAtBY,qBAAqB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Emitter, GemElement, TemplateResult } from '@mantou/gem';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-radio
|
|
4
|
+
* @attr checked
|
|
5
|
+
* @attr value
|
|
6
|
+
* @attr disabled
|
|
7
|
+
*/
|
|
8
|
+
export declare class DuoyunRadioElement extends GemElement {
|
|
9
|
+
#private;
|
|
10
|
+
checked: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
change: Emitter<string>;
|
|
13
|
+
value: string;
|
|
14
|
+
constructor();
|
|
15
|
+
render: () => TemplateResult;
|
|
16
|
+
}
|
|
17
|
+
export declare type Option = {
|
|
18
|
+
label: string | TemplateResult;
|
|
19
|
+
value?: any;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @customElement dy-radio-group
|
|
23
|
+
* @attr disabled
|
|
24
|
+
*/
|
|
25
|
+
export declare class DuoyunRadioGroupElement extends GemElement {
|
|
26
|
+
orientation: 'horizontal' | 'vertical';
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
change: Emitter<any>;
|
|
29
|
+
value: any;
|
|
30
|
+
options?: Option[];
|
|
31
|
+
constructor();
|
|
32
|
+
render: () => TemplateResult | null;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=radio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../src/elements/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,OAAO,EAEP,UAAU,EAGV,cAAc,EACf,MAAM,aAAa,CAAC;AAqCrB;;;;;GAKG;AACH,qBAEa,kBAAmB,SAAQ,UAAU;;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B,KAAK,EAAE,MAAM,CAAC;;IAczB,MAAM,uBAaJ;CACH;AAcD,oBAAY,MAAM,GAAG;IACnB,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC;IAC/B,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC;AAEF;;;GAGG;AACH,qBAEa,uBAAwB,SAAQ,UAAU;IAC1C,WAAW,EAAE,YAAY,GAAG,UAAU,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;;IAO7B,MAAM,8BAcJ;CACH"}
|
|
@@ -0,0 +1,152 @@
|
|
|
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 _DuoyunRadioElement_onClick;
|
|
13
|
+
import { adoptedStyle, attribute, boolattribute, createCSSSheet, css, customElement, property, GemElement, globalemitter, html, } from '@mantou/gem';
|
|
14
|
+
import { theme } from '../lib/theme';
|
|
15
|
+
import { commonHandle } from '../lib/hotkeys';
|
|
16
|
+
const style = createCSSSheet(css `
|
|
17
|
+
:host {
|
|
18
|
+
cursor: default;
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 0.5em;
|
|
22
|
+
}
|
|
23
|
+
:host([disabled]) {
|
|
24
|
+
cursor: not-allowed;
|
|
25
|
+
}
|
|
26
|
+
.radio {
|
|
27
|
+
box-sizing: border-box;
|
|
28
|
+
width: 1em;
|
|
29
|
+
aspect-ratio: 1;
|
|
30
|
+
border: 2px solid currentColor;
|
|
31
|
+
color: ${theme.borderColor};
|
|
32
|
+
background-clip: content-box;
|
|
33
|
+
padding: 2px;
|
|
34
|
+
border-radius: 10em;
|
|
35
|
+
transform: scale(1.001);
|
|
36
|
+
}
|
|
37
|
+
:host(:where(:hover, [checked])) .radio {
|
|
38
|
+
color: ${theme.primaryColor};
|
|
39
|
+
}
|
|
40
|
+
:host([checked]) .radio {
|
|
41
|
+
background-color: currentColor;
|
|
42
|
+
}
|
|
43
|
+
:host([disabled]) .radio {
|
|
44
|
+
background-color: ${theme.disabledColor};
|
|
45
|
+
}
|
|
46
|
+
`);
|
|
47
|
+
/**
|
|
48
|
+
* @customElement dy-radio
|
|
49
|
+
* @attr checked
|
|
50
|
+
* @attr value
|
|
51
|
+
* @attr disabled
|
|
52
|
+
*/
|
|
53
|
+
let DuoyunRadioElement = class DuoyunRadioElement extends GemElement {
|
|
54
|
+
constructor() {
|
|
55
|
+
super();
|
|
56
|
+
_DuoyunRadioElement_onClick.set(this, () => {
|
|
57
|
+
if (this.disabled)
|
|
58
|
+
return;
|
|
59
|
+
if (!this.checked) {
|
|
60
|
+
this.change(this.value);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
this.render = () => {
|
|
64
|
+
return html `
|
|
65
|
+
<div
|
|
66
|
+
role="radio"
|
|
67
|
+
tabindex="0"
|
|
68
|
+
@keydown=${commonHandle}
|
|
69
|
+
aria-labelledby="label"
|
|
70
|
+
aria-disabled=${this.disabled}
|
|
71
|
+
aria-checked=${this.checked}
|
|
72
|
+
class="radio"
|
|
73
|
+
></div>
|
|
74
|
+
<slot id="label"></slot>
|
|
75
|
+
`;
|
|
76
|
+
};
|
|
77
|
+
this.addEventListener('click', __classPrivateFieldGet(this, _DuoyunRadioElement_onClick, "f"));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
_DuoyunRadioElement_onClick = new WeakMap();
|
|
81
|
+
__decorate([
|
|
82
|
+
boolattribute
|
|
83
|
+
], DuoyunRadioElement.prototype, "checked", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
boolattribute
|
|
86
|
+
], DuoyunRadioElement.prototype, "disabled", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
globalemitter
|
|
89
|
+
], DuoyunRadioElement.prototype, "change", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
attribute
|
|
92
|
+
], DuoyunRadioElement.prototype, "value", void 0);
|
|
93
|
+
DuoyunRadioElement = __decorate([
|
|
94
|
+
customElement('dy-radio'),
|
|
95
|
+
adoptedStyle(style)
|
|
96
|
+
], DuoyunRadioElement);
|
|
97
|
+
export { DuoyunRadioElement };
|
|
98
|
+
const groupStyle = createCSSSheet(css `
|
|
99
|
+
:host {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
flex-wrap: wrap;
|
|
103
|
+
}
|
|
104
|
+
:host([orientation='vertical']) {
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
align-items: flex-start;
|
|
107
|
+
}
|
|
108
|
+
`);
|
|
109
|
+
/**
|
|
110
|
+
* @customElement dy-radio-group
|
|
111
|
+
* @attr disabled
|
|
112
|
+
*/
|
|
113
|
+
let DuoyunRadioGroupElement = class DuoyunRadioGroupElement extends GemElement {
|
|
114
|
+
constructor() {
|
|
115
|
+
super();
|
|
116
|
+
this.render = () => {
|
|
117
|
+
if (!this.options)
|
|
118
|
+
return null;
|
|
119
|
+
return html `${this.options.map(({ label, value }) => html `
|
|
120
|
+
<dy-radio
|
|
121
|
+
?disabled=${this.disabled}
|
|
122
|
+
?checked=${(value !== null && value !== void 0 ? value : label) === this.value}
|
|
123
|
+
@change=${() => this.change(value !== null && value !== void 0 ? value : label)}
|
|
124
|
+
>
|
|
125
|
+
${label}
|
|
126
|
+
</dy-radio>
|
|
127
|
+
`)}`;
|
|
128
|
+
};
|
|
129
|
+
this.internals.role = 'radiogroup';
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
__decorate([
|
|
133
|
+
attribute
|
|
134
|
+
], DuoyunRadioGroupElement.prototype, "orientation", void 0);
|
|
135
|
+
__decorate([
|
|
136
|
+
boolattribute
|
|
137
|
+
], DuoyunRadioGroupElement.prototype, "disabled", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
globalemitter
|
|
140
|
+
], DuoyunRadioGroupElement.prototype, "change", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property
|
|
143
|
+
], DuoyunRadioGroupElement.prototype, "value", void 0);
|
|
144
|
+
__decorate([
|
|
145
|
+
property
|
|
146
|
+
], DuoyunRadioGroupElement.prototype, "options", void 0);
|
|
147
|
+
DuoyunRadioGroupElement = __decorate([
|
|
148
|
+
customElement('dy-radio-group'),
|
|
149
|
+
adoptedStyle(groupStyle)
|
|
150
|
+
], DuoyunRadioGroupElement);
|
|
151
|
+
export { DuoyunRadioGroupElement };
|
|
152
|
+
//# sourceMappingURL=radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../src/elements/radio.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,aAAa,EACb,cAAc,EACd,GAAG,EACH,aAAa,EAEb,QAAQ,EACR,UAAU,EACV,aAAa,EACb,IAAI,GAEL,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;aAenB,KAAK,CAAC,WAAW;;;;;;;aAOjB,KAAK,CAAC,YAAY;;;;;;wBAMP,KAAK,CAAC,aAAa;;CAE1C,CAAC,CAAC;AAEH;;;;;GAKG;AAGH,IAAa,kBAAkB,GAA/B,MAAa,kBAAmB,SAAQ,UAAU;IAOhD;QACE,KAAK,EAAE,CAAC;QAIV,sCAAW,GAAG,EAAE;YACd,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;gBACjB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACzB;QACH,CAAC,EAAC;QAEF,WAAM,GAAG,GAAG,EAAE;YACZ,OAAO,IAAI,CAAA;;;;mBAII,YAAY;;wBAEP,IAAI,CAAC,QAAQ;uBACd,IAAI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;AACX;IAAT,QAAQ;wDAAoB;AALlB,uBAAuB;IAFnC,aAAa,CAAC,gBAAgB,CAAC;IAC/B,YAAY,CAAC,UAAU,CAAC;GACZ,uBAAuB,CA2BnC;SA3BY,uBAAuB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { GemElement, Emitter } from '@mantou/gem';
|
|
2
|
+
import '@mantou/gem/elements/use';
|
|
3
|
+
/**
|
|
4
|
+
* @customElement dy-rating
|
|
5
|
+
*/
|
|
6
|
+
export declare class DuoyunRatingElement extends GemElement {
|
|
7
|
+
#private;
|
|
8
|
+
value: number;
|
|
9
|
+
total: number;
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
change: Emitter<number>;
|
|
12
|
+
constructor();
|
|
13
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=rating.d.ts.map
|