feffery-infographic 0.1.0__py3-none-any.whl
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.
- feffery_infographic/Infographic.py +186 -0
- feffery_infographic/__init__.py +86 -0
- feffery_infographic/_imports_.py +3 -0
- feffery_infographic/feffery_infographic.min.js +3 -0
- feffery_infographic/feffery_infographic.min.js.LICENSE.txt +1 -0
- feffery_infographic/feffery_infographic.min.js.map +1 -0
- feffery_infographic/metadata.json +1 -0
- feffery_infographic/package-info.json +67 -0
- feffery_infographic/prompts.py +145 -0
- feffery_infographic-0.1.0.dist-info/METADATA +173 -0
- feffery_infographic-0.1.0.dist-info/RECORD +14 -0
- feffery_infographic-0.1.0.dist-info/WHEEL +5 -0
- feffery_infographic-0.1.0.dist-info/licenses/LICENSE +21 -0
- feffery_infographic-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import typing # noqa: F401
|
|
4
|
+
|
|
5
|
+
from dash.development.base_component import Component, _explicitize_args
|
|
6
|
+
from typing_extensions import Literal, NotRequired, TypedDict # noqa: F401
|
|
7
|
+
|
|
8
|
+
ComponentType = typing.Union[
|
|
9
|
+
str,
|
|
10
|
+
int,
|
|
11
|
+
float,
|
|
12
|
+
Component,
|
|
13
|
+
None,
|
|
14
|
+
typing.Sequence[typing.Union[str, int, float, Component, None]],
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
NumberType = typing.Union[typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class Infographic(Component):
|
|
21
|
+
"""An Infographic component.
|
|
22
|
+
信息图渲染组件
|
|
23
|
+
(Infographic render component)
|
|
24
|
+
|
|
25
|
+
Keyword arguments:
|
|
26
|
+
|
|
27
|
+
- id (string; optional):
|
|
28
|
+
组件唯一id (The unique id of this component).
|
|
29
|
+
|
|
30
|
+
- key (string; optional):
|
|
31
|
+
对当前组件的`key`值进行更新,可实现强制重绘当前组件的效果 (Force update the `key` value of
|
|
32
|
+
the current component, which can force a redraw of the current
|
|
33
|
+
component).
|
|
34
|
+
|
|
35
|
+
- className (string; optional):
|
|
36
|
+
当前组件css类 (The css class of the current component).
|
|
37
|
+
|
|
38
|
+
- syntax (string; required):
|
|
39
|
+
必填,信息图语法 (Required, infographic syntax).
|
|
40
|
+
|
|
41
|
+
- width (number | string; optional):
|
|
42
|
+
信息图宽度,支持数值型和字符型输入 (Infographic width, support numeric and
|
|
43
|
+
character input).
|
|
44
|
+
|
|
45
|
+
- height (number | string; optional):
|
|
46
|
+
信息图高度,支持数值型和字符型输入 (Infographic height, support numeric and
|
|
47
|
+
character input).
|
|
48
|
+
|
|
49
|
+
- padding (number | list of numbers; optional):
|
|
50
|
+
信息图像素内边距,支持数值型,或格式如`[上, 右, 下, 左]`各自方向上像素内边距的数组 (Infographic pixel
|
|
51
|
+
margin, support numeric, or format like `[top, right, bottom,
|
|
52
|
+
left]` array of each direction pixel margin).
|
|
53
|
+
|
|
54
|
+
- editable (boolean; optional):
|
|
55
|
+
是否开启可编辑模式 (Whether to enable editable mode) 默认值:`False` (Default:
|
|
56
|
+
`False`).
|
|
57
|
+
|
|
58
|
+
- exportTrigger (dict; optional):
|
|
59
|
+
每次有效更新都会触发针对当前信息图的图片导出、下载操作,每次执行后都会被重置为空值 (Each time a valid
|
|
60
|
+
update is triggered, a picture export and download operation will
|
|
61
|
+
be triggered for the current infographic, and each time it will be
|
|
62
|
+
reset to an empty value).
|
|
63
|
+
|
|
64
|
+
`exportTrigger` is a dict with keys:
|
|
65
|
+
|
|
66
|
+
- type (a value equal to: 'png', 'svg'; optional):
|
|
67
|
+
图片导出类型,可选项有`'png'`、`'svg'` (Image export type, optional items
|
|
68
|
+
include `'png'` and `'svg'`) 默认值:`'png'` (Default: `'png'`).
|
|
69
|
+
|
|
70
|
+
- dpr (number; optional):
|
|
71
|
+
当导出`'png'`类型图片时,用于设置导出图片的像素比 (When exporting the `'png'` type
|
|
72
|
+
image, set the export image pixel ratio) 默认值:`1` (Default:
|
|
73
|
+
`1`).
|
|
74
|
+
|
|
75
|
+
- download (boolean; optional):
|
|
76
|
+
是否触发下载操作 (Whether to trigger the download operation)
|
|
77
|
+
默认值:`True` (Default: `True`).
|
|
78
|
+
|
|
79
|
+
- fileName (string; optional):
|
|
80
|
+
当触发下载操作时,控制下载文件的文件名 (When triggering the download operation,
|
|
81
|
+
control the download file name) 默认值:`'infographic_export'`
|
|
82
|
+
(Default: `'infographic_export'`).
|
|
83
|
+
|
|
84
|
+
- exportEvent (dict; optional):
|
|
85
|
+
记录最近一次通过参数`exportTrigger`有效触发的图片导出操作事件信息 (Record the latest event
|
|
86
|
+
information of the image export operation triggered by the
|
|
87
|
+
parameter `exportTrigger`).
|
|
88
|
+
|
|
89
|
+
`exportEvent` is a dict with keys:
|
|
90
|
+
|
|
91
|
+
- timestamp (number; optional):
|
|
92
|
+
事件时间戳.
|
|
93
|
+
|
|
94
|
+
- type (a value equal to: 'png', 'svg'; optional):
|
|
95
|
+
图片类型,可能值有`'png'`、`'svg'`.
|
|
96
|
+
|
|
97
|
+
- data (string; optional):
|
|
98
|
+
图片对应`dataURL`数据.
|
|
99
|
+
|
|
100
|
+
- debugWindowInstanceName (string; optional):
|
|
101
|
+
调试用参数,有效设置后会将当前信息图实例挂载到`window`对象下对应的变量名上 (Debugging parameters,
|
|
102
|
+
valid setting will mount the current infographic instance to the
|
|
103
|
+
`window` object under the corresponding variable name)."""
|
|
104
|
+
|
|
105
|
+
_children_props: typing.List[str] = []
|
|
106
|
+
_base_nodes = ['children']
|
|
107
|
+
_namespace = 'feffery_infographic'
|
|
108
|
+
_type = 'Infographic'
|
|
109
|
+
ExportTrigger = TypedDict(
|
|
110
|
+
'ExportTrigger',
|
|
111
|
+
{
|
|
112
|
+
'type': NotRequired[Literal['png', 'svg']],
|
|
113
|
+
'dpr': NotRequired[NumberType],
|
|
114
|
+
'download': NotRequired[bool],
|
|
115
|
+
'fileName': NotRequired[str],
|
|
116
|
+
},
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
ExportEvent = TypedDict(
|
|
120
|
+
'ExportEvent',
|
|
121
|
+
{
|
|
122
|
+
'timestamp': NotRequired[NumberType],
|
|
123
|
+
'type': NotRequired[Literal['png', 'svg']],
|
|
124
|
+
'data': NotRequired[str],
|
|
125
|
+
},
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
def __init__(
|
|
129
|
+
self,
|
|
130
|
+
id: typing.Optional[typing.Union[str, dict]] = None,
|
|
131
|
+
key: typing.Optional[str] = None,
|
|
132
|
+
style: typing.Optional[typing.Any] = None,
|
|
133
|
+
className: typing.Optional[str] = None,
|
|
134
|
+
syntax: typing.Optional[str] = None,
|
|
135
|
+
width: typing.Optional[typing.Union[NumberType, str]] = None,
|
|
136
|
+
height: typing.Optional[typing.Union[NumberType, str]] = None,
|
|
137
|
+
padding: typing.Optional[typing.Union[NumberType, typing.Sequence[NumberType]]] = None,
|
|
138
|
+
editable: typing.Optional[bool] = None,
|
|
139
|
+
exportTrigger: typing.Optional['ExportTrigger'] = None,
|
|
140
|
+
exportEvent: typing.Optional['ExportEvent'] = None,
|
|
141
|
+
debugWindowInstanceName: typing.Optional[str] = None,
|
|
142
|
+
**kwargs,
|
|
143
|
+
):
|
|
144
|
+
self._prop_names = [
|
|
145
|
+
'id',
|
|
146
|
+
'key',
|
|
147
|
+
'style',
|
|
148
|
+
'className',
|
|
149
|
+
'syntax',
|
|
150
|
+
'width',
|
|
151
|
+
'height',
|
|
152
|
+
'padding',
|
|
153
|
+
'editable',
|
|
154
|
+
'exportTrigger',
|
|
155
|
+
'exportEvent',
|
|
156
|
+
'debugWindowInstanceName',
|
|
157
|
+
]
|
|
158
|
+
self._valid_wildcard_attributes = []
|
|
159
|
+
self.available_properties = [
|
|
160
|
+
'id',
|
|
161
|
+
'key',
|
|
162
|
+
'style',
|
|
163
|
+
'className',
|
|
164
|
+
'syntax',
|
|
165
|
+
'width',
|
|
166
|
+
'height',
|
|
167
|
+
'padding',
|
|
168
|
+
'editable',
|
|
169
|
+
'exportTrigger',
|
|
170
|
+
'exportEvent',
|
|
171
|
+
'debugWindowInstanceName',
|
|
172
|
+
]
|
|
173
|
+
self.available_wildcard_properties = []
|
|
174
|
+
_explicit_args = kwargs.pop('_explicit_args')
|
|
175
|
+
_locals = locals()
|
|
176
|
+
_locals.update(kwargs) # For wildcard attrs and excess named props
|
|
177
|
+
args = {k: _locals[k] for k in _explicit_args}
|
|
178
|
+
|
|
179
|
+
for k in ['syntax']:
|
|
180
|
+
if k not in args:
|
|
181
|
+
raise TypeError('Required argument `' + k + '` was not specified.')
|
|
182
|
+
|
|
183
|
+
super(Infographic, self).__init__(**args)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
setattr(Infographic, '__init__', _explicitize_args(Infographic.__init__))
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from __future__ import print_function as _
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os as _os
|
|
5
|
+
import sys as _sys
|
|
6
|
+
|
|
7
|
+
import dash as _dash
|
|
8
|
+
|
|
9
|
+
# noinspection PyUnresolvedReferences
|
|
10
|
+
from ._imports_ import * # noqa: F403
|
|
11
|
+
from ._imports_ import __all__
|
|
12
|
+
|
|
13
|
+
if not hasattr(_dash, '__plotly_dash') and not hasattr(_dash, 'development'):
|
|
14
|
+
print(
|
|
15
|
+
'Dash was not successfully imported. '
|
|
16
|
+
"Make sure you don't have a file "
|
|
17
|
+
'named \n"dash.py" in your current directory.',
|
|
18
|
+
file=_sys.stderr,
|
|
19
|
+
)
|
|
20
|
+
_sys.exit(1)
|
|
21
|
+
|
|
22
|
+
_basepath = _os.path.dirname(__file__)
|
|
23
|
+
_filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json'))
|
|
24
|
+
with open(_filepath) as f:
|
|
25
|
+
package = json.load(f)
|
|
26
|
+
|
|
27
|
+
package_name = package['name'].replace(' ', '_').replace('-', '_')
|
|
28
|
+
__version__ = package['version']
|
|
29
|
+
|
|
30
|
+
_current_path = _os.path.dirname(_os.path.abspath(__file__))
|
|
31
|
+
|
|
32
|
+
_this_module = _sys.modules[__name__]
|
|
33
|
+
|
|
34
|
+
async_resources = []
|
|
35
|
+
|
|
36
|
+
_js_dist = []
|
|
37
|
+
|
|
38
|
+
_js_dist.extend(
|
|
39
|
+
[
|
|
40
|
+
{
|
|
41
|
+
'relative_package_path': 'async-{}.js'.format(async_resource),
|
|
42
|
+
'external_url': ('https://unpkg.com/{0}@{2}/{1}/async-{3}.js').format(
|
|
43
|
+
package_name, __name__, __version__, async_resource
|
|
44
|
+
),
|
|
45
|
+
'namespace': package_name,
|
|
46
|
+
'async': True,
|
|
47
|
+
}
|
|
48
|
+
for async_resource in async_resources
|
|
49
|
+
]
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# TODO: Figure out if unpkg link works
|
|
53
|
+
_js_dist.extend(
|
|
54
|
+
[
|
|
55
|
+
{
|
|
56
|
+
'relative_package_path': 'async-{}.js.map'.format(async_resource),
|
|
57
|
+
'external_url': ('https://unpkg.com/{0}@{2}/{1}/async-{3}.js.map').format(
|
|
58
|
+
package_name, __name__, __version__, async_resource
|
|
59
|
+
),
|
|
60
|
+
'namespace': package_name,
|
|
61
|
+
'dynamic': True,
|
|
62
|
+
}
|
|
63
|
+
for async_resource in async_resources
|
|
64
|
+
]
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
_js_dist.extend(
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
'relative_package_path': 'feffery_infographic.min.js',
|
|
71
|
+
'namespace': package_name,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
'relative_package_path': 'feffery_infographic.min.js.map',
|
|
75
|
+
'namespace': package_name,
|
|
76
|
+
'dynamic': True,
|
|
77
|
+
},
|
|
78
|
+
]
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
_css_dist = []
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
for _component in __all__:
|
|
85
|
+
setattr(locals()[_component], '_js_dist', _js_dist)
|
|
86
|
+
setattr(locals()[_component], '_css_dist', _css_dist)
|