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 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../src/elements/legend.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,OAAO,EAGR,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,WAAW,CAAC;AAgCnB,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAEa,mBAAoB,SAAQ,uBAAuB;;IACpD,MAAM,iBAAgB;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAM;IACxB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;;IAgCnC,MAAM,6CAkBJ;CACH"}
|
|
@@ -0,0 +1,118 @@
|
|
|
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 _DuoyunLegendElement_instances, _DuoyunLegendElement_currentValueSet_get, _DuoyunLegendElement_onWheel, _DuoyunLegendElement_onChange;
|
|
13
|
+
import { html, adoptedStyle, createCSSSheet, css, customElement, property, emitter, classMap, styleMap, } from '@mantou/gem';
|
|
14
|
+
import { theme } from '../lib/theme';
|
|
15
|
+
import { commonColors } from '../lib/color';
|
|
16
|
+
import { DuoyunScrollBaseElement } from './base/scroll';
|
|
17
|
+
import './tooltip';
|
|
18
|
+
const style = createCSSSheet(css `
|
|
19
|
+
:host {
|
|
20
|
+
--color: initial;
|
|
21
|
+
display: flex;
|
|
22
|
+
gap: 1em;
|
|
23
|
+
align-items: center;
|
|
24
|
+
font-size: 0.875em;
|
|
25
|
+
overscroll-behavior: contain;
|
|
26
|
+
scrollbar-width: none;
|
|
27
|
+
}
|
|
28
|
+
.item {
|
|
29
|
+
cursor: default;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: baseline;
|
|
32
|
+
gap: 4px;
|
|
33
|
+
color: var(--color);
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
.item.unselect {
|
|
37
|
+
--color: ${theme.disabledColor};
|
|
38
|
+
}
|
|
39
|
+
.item span {
|
|
40
|
+
line-height: 1;
|
|
41
|
+
width: 0.8em;
|
|
42
|
+
height: 0.6em;
|
|
43
|
+
border-radius: ${theme.smallRound};
|
|
44
|
+
background-color: currentColor;
|
|
45
|
+
}
|
|
46
|
+
`);
|
|
47
|
+
/**
|
|
48
|
+
* @customElement dy-legend
|
|
49
|
+
*/
|
|
50
|
+
let DuoyunLegendElement = class DuoyunLegendElement extends DuoyunScrollBaseElement {
|
|
51
|
+
constructor() {
|
|
52
|
+
super();
|
|
53
|
+
_DuoyunLegendElement_instances.add(this);
|
|
54
|
+
this.colors = commonColors;
|
|
55
|
+
this.legends = [];
|
|
56
|
+
_DuoyunLegendElement_onWheel.set(this, (evt) => {
|
|
57
|
+
this.scrollBy(Math.sign(evt.deltaY) * 30, 0);
|
|
58
|
+
});
|
|
59
|
+
_DuoyunLegendElement_onChange.set(this, (currentValue, value, exclude = false) => {
|
|
60
|
+
const total = this.legends.length;
|
|
61
|
+
if (total === 1)
|
|
62
|
+
return;
|
|
63
|
+
if (currentValue.size === total) {
|
|
64
|
+
return this.change(exclude ? [...currentValue].filter((e) => e !== value) : [value]);
|
|
65
|
+
}
|
|
66
|
+
if (currentValue.has(value)) {
|
|
67
|
+
if (currentValue.size === 1) {
|
|
68
|
+
return this.change(this.legends.map(({ label, value }) => value !== null && value !== void 0 ? value : label));
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return this.change([...currentValue].filter((e) => e !== value));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return this.change([...currentValue, value]);
|
|
75
|
+
});
|
|
76
|
+
this.render = () => {
|
|
77
|
+
var _a;
|
|
78
|
+
const currentValue = __classPrivateFieldGet(this, _DuoyunLegendElement_instances, "a", _DuoyunLegendElement_currentValueSet_get);
|
|
79
|
+
return html `
|
|
80
|
+
${(_a = this.legends) === null || _a === void 0 ? void 0 : _a.map(({ value, label, tooltip }, index) => html `
|
|
81
|
+
<dy-tooltip .content=${tooltip}>
|
|
82
|
+
<div
|
|
83
|
+
class=${classMap({ item: true, unselect: !currentValue.has(value !== null && value !== void 0 ? value : label) })}
|
|
84
|
+
@click=${(e) => __classPrivateFieldGet(this, _DuoyunLegendElement_onChange, "f").call(this, currentValue, value !== null && value !== void 0 ? value : label, e.metaKey || e.ctrlKey)}
|
|
85
|
+
>
|
|
86
|
+
<span style=${styleMap({ color: `var(--color, ${this.colors[index % this.colors.length]})` })}></span>
|
|
87
|
+
${label}
|
|
88
|
+
</div>
|
|
89
|
+
</dy-tooltip>
|
|
90
|
+
`)}
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
this.addEventListener('wheel', __classPrivateFieldGet(this, _DuoyunLegendElement_onWheel, "f"));
|
|
94
|
+
this.internals.ariaHidden = 'ture';
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
_DuoyunLegendElement_onWheel = new WeakMap(), _DuoyunLegendElement_onChange = new WeakMap(), _DuoyunLegendElement_instances = new WeakSet(), _DuoyunLegendElement_currentValueSet_get = function _DuoyunLegendElement_currentValueSet_get() {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
return new Set((_a = this.value) !== null && _a !== void 0 ? _a : (_b = this.legends) === null || _b === void 0 ? void 0 : _b.map(({ value, label }) => value !== null && value !== void 0 ? value : label));
|
|
100
|
+
};
|
|
101
|
+
__decorate([
|
|
102
|
+
property
|
|
103
|
+
], DuoyunLegendElement.prototype, "colors", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
property
|
|
106
|
+
], DuoyunLegendElement.prototype, "legends", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
property
|
|
109
|
+
], DuoyunLegendElement.prototype, "value", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
emitter
|
|
112
|
+
], DuoyunLegendElement.prototype, "change", void 0);
|
|
113
|
+
DuoyunLegendElement = __decorate([
|
|
114
|
+
customElement('dy-legend'),
|
|
115
|
+
adoptedStyle(style)
|
|
116
|
+
], DuoyunLegendElement);
|
|
117
|
+
export { DuoyunLegendElement };
|
|
118
|
+
//# sourceMappingURL=legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.js","sourceRoot":"","sources":["../src/elements/legend.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EACb,QAAQ,EACR,OAAO,EAEP,QAAQ,EACR,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,WAAW,CAAC;AAEnB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;eAmBjB,KAAK,CAAC,aAAa;;;;;;qBAMb,KAAK,CAAC,UAAU;;;CAGpC,CAAC,CAAC;AAQH;;GAEG;AAGH,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,uBAAuB;IAU9D;QACE,KAAK,EAAE,CAAC;;QAVA,WAAM,GAAG,YAAY,CAAC;QACtB,YAAO,GAAc,EAAE,CAAC;QAclC,uCAAW,CAAC,GAAe,EAAE,EAAE;YAC7B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC,EAAC;QAEF,wCAAY,CAAC,YAAyB,EAAE,KAAa,EAAE,OAAO,GAAG,KA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Element dy-line-chart
|
|
4
|
+
*/
|
|
5
|
+
export declare class DuoyunLineChartElement extends DuoyunBarChartElement {
|
|
6
|
+
#private;
|
|
7
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=line-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-chart.d.ts","sourceRoot":"","sources":["../src/elements/line-chart.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAIpD;;GAEG;AACH,qBAEa,sBAAuB,SAAQ,qBAAqB;;IAa/D,MAAM,6CA4EJ;CACH"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 _DuoyunLineChartElement_genPath;
|
|
13
|
+
import { html, svg, adoptedStyle, createCSSSheet, css, customElement } from '@mantou/gem';
|
|
14
|
+
import { isNullish } from '../lib/types';
|
|
15
|
+
import { theme } from '../lib/theme';
|
|
16
|
+
import { DuoyunBarChartElement } from './bar-chart';
|
|
17
|
+
const style = createCSSSheet(css ``);
|
|
18
|
+
/**
|
|
19
|
+
* @customElement dy-line-chart
|
|
20
|
+
*/
|
|
21
|
+
let DuoyunLineChartElement = class DuoyunLineChartElement extends DuoyunBarChartElement {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(...arguments);
|
|
24
|
+
// not support stack
|
|
25
|
+
_DuoyunLineChartElement_genPath.set(this, (values) => {
|
|
26
|
+
return values
|
|
27
|
+
.map((value, i) => {
|
|
28
|
+
if (isNullish(value) || (isNullish(values[i - 1]) && isNullish(values[i + 1])))
|
|
29
|
+
return '';
|
|
30
|
+
return `${isNullish(values[i - 1]) ? 'M' : `L`}${(i + 0.5) / this.xAxiUnit} ${this.stageHeight - ((value || 0) + this.yAxiMin) / this.yAxiUnit}`;
|
|
31
|
+
})
|
|
32
|
+
.join(``);
|
|
33
|
+
});
|
|
34
|
+
this.render = () => {
|
|
35
|
+
if (this.loading)
|
|
36
|
+
return this.renderLoading();
|
|
37
|
+
if (this.noData)
|
|
38
|
+
return this.renderNotData();
|
|
39
|
+
if (!this.contentRect.width || !this.sequences || !this.series)
|
|
40
|
+
return html ``;
|
|
41
|
+
return html `
|
|
42
|
+
<style>
|
|
43
|
+
.line,
|
|
44
|
+
.symbol {
|
|
45
|
+
pointer-events: none;
|
|
46
|
+
}
|
|
47
|
+
.hover:hover ~ .line {
|
|
48
|
+
stroke: ${theme.borderColor};
|
|
49
|
+
stroke-dasharray: ${`${this.getSVGPixel(4)} ${this.getSVGPixel(1.5)}`};
|
|
50
|
+
}
|
|
51
|
+
.symbol {
|
|
52
|
+
stroke-width: ${this.getSVGPixel(1)};
|
|
53
|
+
r: ${this.getSVGPixel(2)};
|
|
54
|
+
fill: ${theme.backgroundColor};
|
|
55
|
+
}
|
|
56
|
+
.hover:hover ~ .symbol {
|
|
57
|
+
r: ${this.getSVGPixel(3)};
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
60
|
+
${svg `
|
|
61
|
+
<svg aria-hidden="true" part="svg" xmlns="http://www.w3.org/2000/svg" viewBox=${this.viewBox.join(' ')}>
|
|
62
|
+
${this.renderXAxi({ centerLabel: true })}
|
|
63
|
+
${this.renderYAxi()}
|
|
64
|
+
${this.sequences.map(({ values }, index) => svg `
|
|
65
|
+
<path
|
|
66
|
+
stroke=${this.colors[index]}
|
|
67
|
+
fill="none"
|
|
68
|
+
stroke-width=${this.getSVGPixel(1)}
|
|
69
|
+
d=${__classPrivateFieldGet(this, _DuoyunLineChartElement_genPath, "f").call(this, values)}
|
|
70
|
+
></path>
|
|
71
|
+
`)}
|
|
72
|
+
${this.series.map((_value, index, _, x = (index + 0.5) / this.xAxiUnit) => svg `
|
|
73
|
+
<g>
|
|
74
|
+
<rect
|
|
75
|
+
@mousemove=${(evt) => this.onMouseMove(index, evt, true)}
|
|
76
|
+
@mouseout=${this.onMouseOut}
|
|
77
|
+
@click=${() => this.clickIndex(index)}
|
|
78
|
+
class="hover"
|
|
79
|
+
fill="transparent"
|
|
80
|
+
x=${index / this.xAxiUnit}
|
|
81
|
+
y=${0}
|
|
82
|
+
width=${1 / this.xAxiUnit}
|
|
83
|
+
height=${this.stageHeight}
|
|
84
|
+
/>
|
|
85
|
+
${this.sequences.map(({ values }, i, _, value = values[index]) => isNullish(value)
|
|
86
|
+
? ''
|
|
87
|
+
: svg `
|
|
88
|
+
<circle
|
|
89
|
+
class="symbol"
|
|
90
|
+
stroke=${this.colors[i]}
|
|
91
|
+
cx=${x}
|
|
92
|
+
cy=${this.stageHeight - (value + this.yAxiMin) / this.yAxiUnit}
|
|
93
|
+
/>
|
|
94
|
+
`)}
|
|
95
|
+
<path
|
|
96
|
+
class="line"
|
|
97
|
+
fill="none"
|
|
98
|
+
stroke-width=${this.getSVGPixel(1)}
|
|
99
|
+
d=${`M${x} 0L${x} ${this.stageHeight}`}
|
|
100
|
+
></path>
|
|
101
|
+
</g>
|
|
102
|
+
`)}
|
|
103
|
+
${this.renderMarkLines()}
|
|
104
|
+
</svg>
|
|
105
|
+
`}
|
|
106
|
+
`;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
_DuoyunLineChartElement_genPath = new WeakMap();
|
|
111
|
+
DuoyunLineChartElement = __decorate([
|
|
112
|
+
customElement('dy-line-chart'),
|
|
113
|
+
adoptedStyle(style)
|
|
114
|
+
], DuoyunLineChartElement);
|
|
115
|
+
export { DuoyunLineChartElement };
|
|
116
|
+
//# sourceMappingURL=line-chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line-chart.js","sourceRoot":"","sources":["../src/elements/line-chart.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1F,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA,EAAE,CAAC,CAAC;AAEpC;;GAEG;AAGH,IAAa,sBAAsB,GAAnC,MAAa,sBAAuB,SAAQ,qBAAqB;IAAjE;;QACE,oBAAoB;QACpB,0CAAW,CAAC,MAAyB,EAAE,EAAE;YACvC,OAAO,MAAM;iBACV,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;gBAChB,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBAAE,OAAO,EAAE,CAAC;gBAC1F,OAAO,GAAG,SAAS,CA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AAI,CAAC,eAAe,EAAE;;OAE3B;KACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA,CAAA;;AA1FY,sBAAsB;IAFlC,aAAa,CAAC,eAAe,CAAC;IAC9B,YAAY,CAAC,KAAK,CAAC;GACP,sBAAsB,CA0FlC;SA1FY,sBAAsB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GemLinkElement, GemActiveLinkElement } from '@mantou/gem/elements/link';
|
|
2
|
+
/**
|
|
3
|
+
* @customElement dy-link
|
|
4
|
+
*/
|
|
5
|
+
export declare class DouyunLinkElement extends GemLinkElement {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @customElement dy-active-link
|
|
10
|
+
*/
|
|
11
|
+
export declare class DuoyunActiveLinkElement extends GemActiveLinkElement {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/elements/link.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAWjF;;GAEG;AACH,qBAEa,iBAAkB,SAAQ,cAAc;;CAMpD;AAED;;GAEG;AACH,qBAEa,uBAAwB,SAAQ,oBAAoB;;CAMhE"}
|
package/elements/link.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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 { GemLinkElement, GemActiveLinkElement } from '@mantou/gem/elements/link';
|
|
9
|
+
import { commonHandle } from '../lib/hotkeys';
|
|
10
|
+
const style = createCSSSheet(css `
|
|
11
|
+
:host {
|
|
12
|
+
color: inherit;
|
|
13
|
+
text-decoration: inherit;
|
|
14
|
+
}
|
|
15
|
+
`);
|
|
16
|
+
/**
|
|
17
|
+
* @customElement dy-link
|
|
18
|
+
*/
|
|
19
|
+
let DouyunLinkElement = class DouyunLinkElement extends GemLinkElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
this.tabIndex = 0;
|
|
23
|
+
this.addEventListener('keydown', commonHandle);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
DouyunLinkElement = __decorate([
|
|
27
|
+
customElement('dy-link'),
|
|
28
|
+
adoptedStyle(style)
|
|
29
|
+
], DouyunLinkElement);
|
|
30
|
+
export { DouyunLinkElement };
|
|
31
|
+
/**
|
|
32
|
+
* @customElement dy-active-link
|
|
33
|
+
*/
|
|
34
|
+
let DuoyunActiveLinkElement = class DuoyunActiveLinkElement extends GemActiveLinkElement {
|
|
35
|
+
constructor() {
|
|
36
|
+
super();
|
|
37
|
+
this.tabIndex = 0;
|
|
38
|
+
this.addEventListener('keydown', commonHandle);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
DuoyunActiveLinkElement = __decorate([
|
|
42
|
+
customElement('dy-active-link'),
|
|
43
|
+
adoptedStyle(style)
|
|
44
|
+
], DuoyunActiveLinkElement);
|
|
45
|
+
export { DuoyunActiveLinkElement };
|
|
46
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../src/elements/link.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;CAK/B,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,cAAc;IACnD;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AANY,iBAAiB;IAF7B,aAAa,CAAC,SAAS,CAAC;IACxB,YAAY,CAAC,KAAK,CAAC;GACP,iBAAiB,CAM7B;SANY,iBAAiB;AAQ9B;;GAEG;AAGH,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,oBAAoB;IAC/D;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,gBAAgB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;CACF,CAAA;AANY,uBAAuB;IAFnC,aAAa,CAAC,gBAAgB,CAAC;IAC/B,YAAY,CAAC,KAAK,CAAC;GACP,uBAAuB,CAMnC;SANY,uBAAuB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GemElement, TemplateResult } from '@mantou/gem';
|
|
2
|
+
import type { Status } from './status-light';
|
|
3
|
+
import './avatar';
|
|
4
|
+
import './divider';
|
|
5
|
+
declare type Item = {
|
|
6
|
+
title: string | TemplateResult;
|
|
7
|
+
description?: string | TemplateResult;
|
|
8
|
+
avatar?: string | TemplateResult;
|
|
9
|
+
status?: Status;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* @customElement dy-list
|
|
13
|
+
*/
|
|
14
|
+
export declare class DuoyunListElement extends GemElement {
|
|
15
|
+
data?: Item[];
|
|
16
|
+
renderItem?: (item: Item) => TemplateResult;
|
|
17
|
+
constructor();
|
|
18
|
+
render: () => TemplateResult;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @customElement dy-list-item
|
|
22
|
+
*/
|
|
23
|
+
export declare class DuoyunListItemElement extends GemElement {
|
|
24
|
+
data?: Item;
|
|
25
|
+
renderItem?: (item: Item) => TemplateResult;
|
|
26
|
+
constructor();
|
|
27
|
+
render: () => TemplateResult;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../src/elements/list.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAMV,cAAc,EAEf,MAAM,aAAa,CAAC;AAIrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AAEnB,aAAK,IAAI,GAAG;IACV,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAWF;;GAEG;AACH,qBAEa,iBAAkB,SAAQ,UAAU;IACrC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC;;IAOtD,MAAM,uBAQJ;CACH;AA4BD;;GAEG;AACH,qBAEa,qBAAsB,SAAQ,UAAU;IACzC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC;;IAOtD,MAAM,uBAoBJ;CACH"}
|
package/elements/list.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
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
|
+
// TODO: implement infinite scroll
|
|
8
|
+
import { GemElement, html, adoptedStyle, createCSSSheet, css, customElement, property, } from '@mantou/gem';
|
|
9
|
+
import { theme } from '../lib/theme';
|
|
10
|
+
import './avatar';
|
|
11
|
+
import './divider';
|
|
12
|
+
const style = createCSSSheet(css `
|
|
13
|
+
:host {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 0.5em;
|
|
17
|
+
font-size: 0.875em;
|
|
18
|
+
}
|
|
19
|
+
`);
|
|
20
|
+
/**
|
|
21
|
+
* @customElement dy-list
|
|
22
|
+
*/
|
|
23
|
+
let DuoyunListElement = class DuoyunListElement extends GemElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
this.render = () => {
|
|
27
|
+
var _a;
|
|
28
|
+
return html `${(_a = this.data) === null || _a === void 0 ? void 0 : _a.map((item) => html `
|
|
29
|
+
<dy-list-item .data=${item} .renderItem=${this.renderItem}></dy-list-item>
|
|
30
|
+
<dy-divider></dy-divider>
|
|
31
|
+
`)}`;
|
|
32
|
+
};
|
|
33
|
+
this.internals.role = 'list';
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
__decorate([
|
|
37
|
+
property
|
|
38
|
+
], DuoyunListElement.prototype, "data", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
property
|
|
41
|
+
], DuoyunListElement.prototype, "renderItem", void 0);
|
|
42
|
+
DuoyunListElement = __decorate([
|
|
43
|
+
customElement('dy-list'),
|
|
44
|
+
adoptedStyle(style)
|
|
45
|
+
], DuoyunListElement);
|
|
46
|
+
export { DuoyunListElement };
|
|
47
|
+
const itemStyle = createCSSSheet(css `
|
|
48
|
+
:host {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 1em;
|
|
52
|
+
}
|
|
53
|
+
.content {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex-direction: column;
|
|
56
|
+
gap: 0.2em;
|
|
57
|
+
min-width: 0;
|
|
58
|
+
}
|
|
59
|
+
.title,
|
|
60
|
+
.description {
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
63
|
+
white-space: nowrap;
|
|
64
|
+
}
|
|
65
|
+
.title {
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
}
|
|
68
|
+
.description {
|
|
69
|
+
color: ${theme.describeColor};
|
|
70
|
+
}
|
|
71
|
+
`);
|
|
72
|
+
/**
|
|
73
|
+
* @customElement dy-list-item
|
|
74
|
+
*/
|
|
75
|
+
let DuoyunListItemElement = class DuoyunListItemElement extends GemElement {
|
|
76
|
+
constructor() {
|
|
77
|
+
super({ isAsync: true });
|
|
78
|
+
this.render = () => {
|
|
79
|
+
if (!this.data)
|
|
80
|
+
return html ``;
|
|
81
|
+
const { title, avatar, description, status } = this.data;
|
|
82
|
+
return this.renderItem
|
|
83
|
+
? this.renderItem(this.data)
|
|
84
|
+
: html `
|
|
85
|
+
${!avatar
|
|
86
|
+
? ''
|
|
87
|
+
: html `
|
|
88
|
+
<div class="avatar">
|
|
89
|
+
${typeof avatar === 'string'
|
|
90
|
+
? html `<dy-avatar src=${avatar} alt="Avatar" .status=${status}></dy-avatar>`
|
|
91
|
+
: avatar}
|
|
92
|
+
</div>
|
|
93
|
+
`}
|
|
94
|
+
<div class="content">
|
|
95
|
+
<div class="title">${title}</div>
|
|
96
|
+
<div class="description">${description}</div>
|
|
97
|
+
</div>
|
|
98
|
+
`;
|
|
99
|
+
};
|
|
100
|
+
this.internals.role = 'listitem';
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
__decorate([
|
|
104
|
+
property
|
|
105
|
+
], DuoyunListItemElement.prototype, "data", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
property
|
|
108
|
+
], DuoyunListItemElement.prototype, "renderItem", void 0);
|
|
109
|
+
DuoyunListItemElement = __decorate([
|
|
110
|
+
customElement('dy-list-item'),
|
|
111
|
+
adoptedStyle(itemStyle)
|
|
112
|
+
], DuoyunListItemElement);
|
|
113
|
+
export { DuoyunListItemElement };
|
|
114
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../src/elements/list.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,OAAO,EACL,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,cAAc,EACd,GAAG,EACH,aAAa,EAEb,QAAQ,GACT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,OAAO,UAAU,CAAC;AAClB,OAAO,WAAW,CAAC;AASnB,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;CAO/B,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,iBAAiB,GAA9B,MAAa,iBAAkB,SAAQ,UAAU;IAI/C;QACE,KAAK,EAAE,CAAC;QAIV,WAAM,GAAG,GAAG,EAAE;;YACZ,OAAO,IAAI,CAAA,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,GAAG,CAC1B,CAAC,IAAI,EAAE,EAAE,CACP,IAAI,CAAA;gCAC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AAC;IACnC,CAAC;CAuBF,CAAA;AA7BW;IAAT,QAAQ;mDAAa;AACZ;IAAT,QAAQ;yDAA6C;AAF3C,qBAAqB;IAFjC,aAAa,CAAC,cAAc,CAAC;IAC7B,YAAY,CAAC,SAAS,CAAC;GACX,qBAAqB,CA8BjC;SA9BY,qBAAqB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DuoyunVisibleBaseElement } from './base/visible';
|
|
2
|
+
import '@mantou/gem/elements/use';
|
|
3
|
+
/**
|
|
4
|
+
* @customElement dy-loading
|
|
5
|
+
*/
|
|
6
|
+
export declare class DuoyunLoadingElement extends DuoyunVisibleBaseElement {
|
|
7
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=loading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.d.ts","sourceRoot":"","sources":["../src/elements/loading.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,0BAA0B,CAAC;AAiBlC;;GAEG;AACH,qBAEa,oBAAqB,SAAQ,wBAAwB;IAChE,MAAM,6CAKJ;CACH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { customElement, html, adoptedStyle, css, createCSSSheet } from '@mantou/gem';
|
|
8
|
+
import { icons } from '../lib/icons';
|
|
9
|
+
import { DuoyunVisibleBaseElement } from './base/visible';
|
|
10
|
+
import '@mantou/gem/elements/use';
|
|
11
|
+
const style = createCSSSheet(css `
|
|
12
|
+
:host {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
font-size: 0.875em;
|
|
17
|
+
}
|
|
18
|
+
.icon {
|
|
19
|
+
width: 2em;
|
|
20
|
+
}
|
|
21
|
+
.describe {
|
|
22
|
+
opacity: 0.7;
|
|
23
|
+
}
|
|
24
|
+
`);
|
|
25
|
+
/**
|
|
26
|
+
* @customElement dy-loading
|
|
27
|
+
*/
|
|
28
|
+
let DuoyunLoadingElement = class DuoyunLoadingElement extends DuoyunVisibleBaseElement {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.render = () => {
|
|
32
|
+
return html `
|
|
33
|
+
<gem-use class="icon" .element=${icons.loading}></gem-use>
|
|
34
|
+
<span class="describe"><slot></slot></span>
|
|
35
|
+
`;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
DuoyunLoadingElement = __decorate([
|
|
40
|
+
customElement('dy-loading'),
|
|
41
|
+
adoptedStyle(style)
|
|
42
|
+
], DuoyunLoadingElement);
|
|
43
|
+
export { DuoyunLoadingElement };
|
|
44
|
+
//# sourceMappingURL=loading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading.js","sourceRoot":"","sources":["../src/elements/loading.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,0BAA0B,CAAC;AAElC,MAAM,KAAK,GAAG,cAAc,CAAC,GAAG,CAAA;;;;;;;;;;;;;CAa/B,CAAC,CAAC;AAEH;;GAEG;AAGH,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,wBAAwB;IAAlE;;QACE,WAAM,GAAG,GAAG,EAAE;YACZ,OAAO,IAAI,CAAA;uCACwB,KAAK,CAAC,OAAO;;KAE/C,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC;CAAA,CAAA;AAPY,oBAAoB;IAFhC,aAAa,CAAC,YAAY,CAAC;IAC3B,YAAY,CAAC,KAAK,CAAC;GACP,oBAAoB,CAOhC;SAPY,oBAAoB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Emitter } from '@mantou/gem';
|
|
2
|
+
import type { PanEventDetail } from '@mantou/gem/elements/gesture';
|
|
3
|
+
export type { PanEventDetail } from '@mantou/gem/elements/gesture';
|
|
4
|
+
import { DuoyunLoadableBaseElement } from './base/loadable';
|
|
5
|
+
import '@mantou/gem/elements/gesture';
|
|
6
|
+
export declare const geoCommonProjection: () => import("d3-geo").GeoProjection;
|
|
7
|
+
export declare const shapes: {
|
|
8
|
+
strokeScale: number;
|
|
9
|
+
scale: number;
|
|
10
|
+
d: string;
|
|
11
|
+
}[];
|
|
12
|
+
declare type Area = {
|
|
13
|
+
name: string;
|
|
14
|
+
path: string | null;
|
|
15
|
+
center: number[];
|
|
16
|
+
};
|
|
17
|
+
export declare type GeoCommonProjection = typeof geoCommonProjection;
|
|
18
|
+
export declare type Geo = GeoJSON.FeatureCollection;
|
|
19
|
+
export declare type Node = {
|
|
20
|
+
id: string;
|
|
21
|
+
type?: '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7';
|
|
22
|
+
position: number[];
|
|
23
|
+
};
|
|
24
|
+
declare type State = {
|
|
25
|
+
currentNode?: Node;
|
|
26
|
+
currentArea?: Area;
|
|
27
|
+
};
|
|
28
|
+
export declare type NodeEventDetail = {
|
|
29
|
+
id: string;
|
|
30
|
+
originEvent: MouseEvent;
|
|
31
|
+
};
|
|
32
|
+
export declare type AreaEventDetail = {
|
|
33
|
+
name: string;
|
|
34
|
+
originEvent: MouseEvent;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @customElement dy-map
|
|
38
|
+
* @fire hover-node
|
|
39
|
+
* @fire leave-node
|
|
40
|
+
* @fire click-node
|
|
41
|
+
* @fire hover-area
|
|
42
|
+
* @fire leave-area
|
|
43
|
+
* @fire click-area
|
|
44
|
+
*/
|
|
45
|
+
export declare class DuoyunMapElement extends DuoyunLoadableBaseElement<State> {
|
|
46
|
+
#private;
|
|
47
|
+
getProjection?: (fn: GeoCommonProjection) => ReturnType<GeoCommonProjection>;
|
|
48
|
+
geo?: Geo;
|
|
49
|
+
getAreaColor?: (name: string, isCurrent: boolean) => string | undefined;
|
|
50
|
+
getAreaName?: (name: string, isCurrent: boolean) => string | undefined;
|
|
51
|
+
nodes?: Node[];
|
|
52
|
+
getNodeColor?: (id: string, isCurrent: boolean) => string | undefined;
|
|
53
|
+
scale: number;
|
|
54
|
+
translate2D: number[];
|
|
55
|
+
grabbing: boolean;
|
|
56
|
+
pan: Emitter<PanEventDetail>;
|
|
57
|
+
hoverNode: Emitter<NodeEventDetail>;
|
|
58
|
+
leaveNode: Emitter<NodeEventDetail>;
|
|
59
|
+
clickNode: Emitter<NodeEventDetail>;
|
|
60
|
+
hoverArea: Emitter<AreaEventDetail>;
|
|
61
|
+
clickArea: Emitter<AreaEventDetail>;
|
|
62
|
+
leaveArea: Emitter<AreaEventDetail>;
|
|
63
|
+
constructor();
|
|
64
|
+
state: State;
|
|
65
|
+
willMount: () => void;
|
|
66
|
+
render: () => import("@mantou/gem").TemplateResult;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../src/elements/map.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,OAAO,EAIR,MAAM,aAAa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