@dou-ui/dashboard 0.0.0-stage → 0.1.0-alpha.0

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.
Files changed (188) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/dist/chart/chart-settings.js +6 -0
  4. package/dist/chart/chart-settings.js.map +1 -0
  5. package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js +122 -0
  6. package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  7. package/dist/chart/chart.js +6 -0
  8. package/dist/chart/chart.js.map +1 -0
  9. package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js +99 -0
  10. package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js.map +1 -0
  11. package/dist/chart/index.js +33 -0
  12. package/dist/chart/index.js.map +1 -0
  13. package/dist/collaboration/index.js +281 -0
  14. package/dist/collaboration/index.js.map +1 -0
  15. package/dist/collaboration/order.js +88 -0
  16. package/dist/collaboration/order.js.map +1 -0
  17. package/dist/core/document.js +128 -0
  18. package/dist/core/document.js.map +1 -0
  19. package/dist/core/history.js +66 -0
  20. package/dist/core/history.js.map +1 -0
  21. package/dist/core/transaction.js +218 -0
  22. package/dist/core/transaction.js.map +1 -0
  23. package/dist/dashboard/dashboard.js +6 -0
  24. package/dist/dashboard/dashboard.js.map +1 -0
  25. package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js +1072 -0
  26. package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js.map +1 -0
  27. package/dist/dashboard/export.js +77 -0
  28. package/dist/dashboard/export.js.map +1 -0
  29. package/dist/dashboard/filter-bar.js +6 -0
  30. package/dist/dashboard/filter-bar.js.map +1 -0
  31. package/dist/dashboard/filter-bar.vue_vue_type_script_setup_true_lang.js +150 -0
  32. package/dist/dashboard/filter-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/dashboard/frame-context.js +5 -0
  34. package/dist/dashboard/frame-context.js.map +1 -0
  35. package/dist/dashboard/observers.js +48 -0
  36. package/dist/dashboard/observers.js.map +1 -0
  37. package/dist/dashboard/palette.js +6 -0
  38. package/dist/dashboard/palette.js.map +1 -0
  39. package/dist/dashboard/palette.vue_vue_type_script_setup_true_lang.js +54 -0
  40. package/dist/dashboard/palette.vue_vue_type_script_setup_true_lang.js.map +1 -0
  41. package/dist/dashboard/widget-body.js +6 -0
  42. package/dist/dashboard/widget-body.js.map +1 -0
  43. package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js +96 -0
  44. package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js.map +1 -0
  45. package/dist/dashboard/widget-frame.js +6 -0
  46. package/dist/dashboard/widget-frame.js.map +1 -0
  47. package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js +300 -0
  48. package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js.map +1 -0
  49. package/dist/dashboard/widget-settings.js +6 -0
  50. package/dist/dashboard/widget-settings.js.map +1 -0
  51. package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js +36 -0
  52. package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  53. package/dist/data/context.js +5 -0
  54. package/dist/data/context.js.map +1 -0
  55. package/dist/data/filters.js +31 -0
  56. package/dist/data/filters.js.map +1 -0
  57. package/dist/data/store.js +214 -0
  58. package/dist/data/store.js.map +1 -0
  59. package/dist/grid/grid-handle.js +6 -0
  60. package/dist/grid/grid-handle.js.map +1 -0
  61. package/dist/grid/grid-handle.vue_vue_type_script_setup_true_lang.js +21 -0
  62. package/dist/grid/grid-handle.vue_vue_type_script_setup_true_lang.js.map +1 -0
  63. package/dist/grid/grid-item.js +80 -0
  64. package/dist/grid/grid-item.js.map +1 -0
  65. package/dist/grid/grid-layout.js +6 -0
  66. package/dist/grid/grid-layout.js.map +1 -0
  67. package/dist/grid/grid-layout.vue_vue_type_script_setup_true_lang.js +767 -0
  68. package/dist/grid/grid-layout.vue_vue_type_script_setup_true_lang.js.map +1 -0
  69. package/dist/grid/tiers.js +31 -0
  70. package/dist/grid/tiers.js.map +1 -0
  71. package/dist/index.js +23 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/layout/engine.js +284 -0
  74. package/dist/layout/engine.js.map +1 -0
  75. package/dist/layout/index.js +1 -0
  76. package/dist/locale.js +245 -0
  77. package/dist/locale.js.map +1 -0
  78. package/dist/pivot/index.js +47 -0
  79. package/dist/pivot/index.js.map +1 -0
  80. package/dist/pivot/pivot-settings.js +6 -0
  81. package/dist/pivot/pivot-settings.js.map +1 -0
  82. package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js +64 -0
  83. package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  84. package/dist/pivot/pivot.js +6 -0
  85. package/dist/pivot/pivot.js.map +1 -0
  86. package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js +76 -0
  87. package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js.map +1 -0
  88. package/dist/style.css +1 -0
  89. package/dist/style.d.ts +1 -0
  90. package/dist/style.js +12 -0
  91. package/dist/types/chart/chart-settings.vue.d.ts +11 -0
  92. package/dist/types/chart/chart.vue.d.ts +3 -0
  93. package/dist/types/chart/index.d.ts +9 -0
  94. package/dist/types/chart/types.d.ts +23 -0
  95. package/dist/types/collaboration/index.d.ts +53 -0
  96. package/dist/types/collaboration/order.d.ts +20 -0
  97. package/dist/types/core/collaboration.d.ts +51 -0
  98. package/dist/types/core/document.d.ts +35 -0
  99. package/dist/types/core/history.d.ts +15 -0
  100. package/dist/types/core/transaction.d.ts +86 -0
  101. package/dist/types/core/types.d.ts +27 -0
  102. package/dist/types/dashboard/dashboard.vue.d.ts +33 -0
  103. package/dist/types/dashboard/export.d.ts +11 -0
  104. package/dist/types/dashboard/filter-bar.vue.d.ts +19 -0
  105. package/dist/types/dashboard/frame-context.d.ts +54 -0
  106. package/dist/types/dashboard/observers.d.ts +15 -0
  107. package/dist/types/dashboard/palette.vue.d.ts +20 -0
  108. package/dist/types/dashboard/types.d.ts +190 -0
  109. package/dist/types/dashboard/widget-body.vue.d.ts +19 -0
  110. package/dist/types/dashboard/widget-frame.vue.d.ts +6 -0
  111. package/dist/types/dashboard/widget-settings.vue.d.ts +16 -0
  112. package/dist/types/data/context.d.ts +18 -0
  113. package/dist/types/data/filters.d.ts +9 -0
  114. package/dist/types/data/store.d.ts +48 -0
  115. package/dist/types/data/types.d.ts +67 -0
  116. package/dist/types/grid/grid-handle.vue.d.ts +18 -0
  117. package/dist/types/grid/grid-item.d.ts +78 -0
  118. package/dist/types/grid/grid-layout.vue.d.ts +46 -0
  119. package/dist/types/grid/tiers.d.ts +12 -0
  120. package/dist/types/grid/types.d.ts +113 -0
  121. package/dist/types/index.d.ts +295 -0
  122. package/dist/types/layout/engine.d.ts +50 -0
  123. package/dist/types/layout/index.d.ts +2 -0
  124. package/dist/types/layout/types.d.ts +39 -0
  125. package/dist/types/locale.d.ts +117 -0
  126. package/dist/types/pivot/index.d.ts +14 -0
  127. package/dist/types/pivot/pivot-settings.vue.d.ts +16 -0
  128. package/dist/types/pivot/pivot.vue.d.ts +7 -0
  129. package/dist/types/pivot/types.d.ts +11 -0
  130. package/dist/types/widget/context.d.ts +91 -0
  131. package/dist/types/widget/define.d.ts +50 -0
  132. package/dist/types/widgets/field-select.vue.d.ts +18 -0
  133. package/dist/types/widgets/index.d.ts +15 -0
  134. package/dist/types/widgets/settings-field.vue.d.ts +17 -0
  135. package/dist/types/widgets/shared.d.ts +20 -0
  136. package/dist/types/widgets/source-field.vue.d.ts +15 -0
  137. package/dist/types/widgets/stat-settings.vue.d.ts +11 -0
  138. package/dist/types/widgets/stat.vue.d.ts +3 -0
  139. package/dist/types/widgets/table-settings.vue.d.ts +11 -0
  140. package/dist/types/widgets/table.vue.d.ts +3 -0
  141. package/dist/types/widgets/text-settings.vue.d.ts +11 -0
  142. package/dist/types/widgets/text.vue.d.ts +3 -0
  143. package/dist/types/widgets/types.d.ts +38 -0
  144. package/dist/widget/context.js +88 -0
  145. package/dist/widget/context.js.map +1 -0
  146. package/dist/widget/define.js +32 -0
  147. package/dist/widget/define.js.map +1 -0
  148. package/dist/widgets/field-select.js +6 -0
  149. package/dist/widgets/field-select.js.map +1 -0
  150. package/dist/widgets/field-select.vue_vue_type_script_setup_true_lang.js +54 -0
  151. package/dist/widgets/field-select.vue_vue_type_script_setup_true_lang.js.map +1 -0
  152. package/dist/widgets/index.js +74 -0
  153. package/dist/widgets/index.js.map +1 -0
  154. package/dist/widgets/settings-field.js +6 -0
  155. package/dist/widgets/settings-field.js.map +1 -0
  156. package/dist/widgets/settings-field.vue_vue_type_script_setup_true_lang.js +28 -0
  157. package/dist/widgets/settings-field.vue_vue_type_script_setup_true_lang.js.map +1 -0
  158. package/dist/widgets/shared.js +68 -0
  159. package/dist/widgets/shared.js.map +1 -0
  160. package/dist/widgets/source-field.js +6 -0
  161. package/dist/widgets/source-field.js.map +1 -0
  162. package/dist/widgets/source-field.vue_vue_type_script_setup_true_lang.js +47 -0
  163. package/dist/widgets/source-field.vue_vue_type_script_setup_true_lang.js.map +1 -0
  164. package/dist/widgets/stat-settings.js +6 -0
  165. package/dist/widgets/stat-settings.js.map +1 -0
  166. package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js +107 -0
  167. package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  168. package/dist/widgets/stat.js +6 -0
  169. package/dist/widgets/stat.js.map +1 -0
  170. package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js +72 -0
  171. package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js.map +1 -0
  172. package/dist/widgets/table-settings.js +6 -0
  173. package/dist/widgets/table-settings.js.map +1 -0
  174. package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js +90 -0
  175. package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  176. package/dist/widgets/table.js +6 -0
  177. package/dist/widgets/table.js.map +1 -0
  178. package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js +91 -0
  179. package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js.map +1 -0
  180. package/dist/widgets/text-settings.js +6 -0
  181. package/dist/widgets/text-settings.js.map +1 -0
  182. package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js +63 -0
  183. package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js.map +1 -0
  184. package/dist/widgets/text.js +6 -0
  185. package/dist/widgets/text.js.map +1 -0
  186. package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js +16 -0
  187. package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js.map +1 -0
  188. package/package.json +98 -4
package/dist/locale.js ADDED
@@ -0,0 +1,245 @@
1
+ import { useLocale } from "dou-ui";
2
+ import { computed, toValue } from "vue";
3
+ // src/locale.ts
4
+ var zhCN = {
5
+ layout: "网格布局",
6
+ item: "格子",
7
+ itemHint: "按 Enter 拿起,再用方向键移动、Shift 加方向键调整大小",
8
+ locked: "{item} 已锁定,不能移动",
9
+ position: "第 {x} 列第 {y} 行,宽 {w} 列,高 {h} 行",
10
+ order: "第 {n} 个,共 {count} 个",
11
+ grabbed: "已拿起 {item},{position}。方向键移动,Shift 加方向键调整大小,Enter 放下,Esc 取消",
12
+ dropped: "已放下 {item},{position}",
13
+ cancelled: "已取消,{item} 回到原处",
14
+ resize: "调整大小",
15
+ dashboard: "仪表盘",
16
+ widgetMenu: "格子操作",
17
+ settings: "设置",
18
+ fullscreen: "全屏查看",
19
+ export: "导出",
20
+ exportFailed: "无法导出 {name}:{reason}",
21
+ exported: "已导出 {name}",
22
+ nothingToExport: "没有可导出的数据",
23
+ duplicate: "复制一份",
24
+ remove: "删除",
25
+ settingsTitle: "{title}的设置",
26
+ titleField: "标题",
27
+ added: "已添加 {item}",
28
+ removed: "已删除 {item}",
29
+ unknownType: "没有注册类型为 {type} 的格子",
30
+ loading: "加载中",
31
+ error: "加载失败",
32
+ empty: "暂无数据",
33
+ retry: "重试",
34
+ emptyTitle: "还没有格子",
35
+ emptyHint: "从列表里拖进来,或点一下添加",
36
+ palette: "添加格子",
37
+ paletteItem: "添加{label}",
38
+ filteredBy: "已按 {value} 筛选",
39
+ peerMoving: "{name} 正在移动",
40
+ peerResizing: "{name} 正在调整大小",
41
+ peerSettings: "{name} 正在修改设置",
42
+ clearFilter: "清除筛选:{value}",
43
+ filterBar: "筛选",
44
+ linkedFilter: "{title}:{value}",
45
+ clearFilters: "清除筛选",
46
+ source: "数据源",
47
+ noSource: "不使用数据源",
48
+ field: "字段",
49
+ value: "数值",
50
+ prefix: "前缀",
51
+ suffix: "后缀",
52
+ precision: "小数位数",
53
+ trend: "迷你图字段",
54
+ delta: "变化率字段",
55
+ deltaText: "较上期 {value}",
56
+ text: "文字",
57
+ textSize: "字号",
58
+ sizeSmall: "小",
59
+ sizeMedium: "中",
60
+ sizeLarge: "大",
61
+ columns: "列",
62
+ columnTitle: "{field} 的标题",
63
+ chartKind: "图表",
64
+ chartLine: "折线图",
65
+ chartArea: "面积图",
66
+ chartBar: "柱状图",
67
+ chartPie: "饼图",
68
+ xField: "分类或时间",
69
+ yFields: "数值",
70
+ stacked: "堆叠",
71
+ horizontal: "横向",
72
+ chartFilter: "点击时筛选",
73
+ chartFilterHint: "点图表里的一项时,用这个名字筛选其他格子;留空则不筛选",
74
+ pivotFilter: "点击单元格时,按它所在的分组筛选其他格子"
75
+ };
76
+ var zhTW = {
77
+ layout: "網格版面",
78
+ item: "格子",
79
+ itemHint: "按 Enter 拿起,再用方向鍵移動、Shift 加方向鍵調整大小",
80
+ locked: "{item} 已鎖定,無法移動",
81
+ position: "第 {x} 欄第 {y} 列,寬 {w} 欄,高 {h} 列",
82
+ order: "第 {n} 個,共 {count} 個",
83
+ grabbed: "已拿起 {item},{position}。方向鍵移動,Shift 加方向鍵調整大小,Enter 放下,Esc 取消",
84
+ dropped: "已放下 {item},{position}",
85
+ cancelled: "已取消,{item} 回到原處",
86
+ resize: "調整大小",
87
+ dashboard: "儀表板",
88
+ widgetMenu: "格子操作",
89
+ settings: "設定",
90
+ fullscreen: "全螢幕檢視",
91
+ export: "匯出",
92
+ exportFailed: "無法匯出 {name}:{reason}",
93
+ exported: "已匯出 {name}",
94
+ nothingToExport: "沒有可匯出的資料",
95
+ duplicate: "複製一份",
96
+ remove: "刪除",
97
+ settingsTitle: "{title}的設定",
98
+ titleField: "標題",
99
+ added: "已新增 {item}",
100
+ removed: "已刪除 {item}",
101
+ unknownType: "沒有註冊類型為 {type} 的格子",
102
+ loading: "載入中",
103
+ error: "載入失敗",
104
+ empty: "暫無資料",
105
+ retry: "重試",
106
+ emptyTitle: "還沒有格子",
107
+ emptyHint: "從清單拖進來,或點一下新增",
108
+ palette: "新增格子",
109
+ paletteItem: "新增{label}",
110
+ filteredBy: "已按 {value} 篩選",
111
+ peerMoving: "{name} 正在移動",
112
+ peerResizing: "{name} 正在調整大小",
113
+ peerSettings: "{name} 正在修改設定",
114
+ clearFilter: "清除篩選:{value}",
115
+ filterBar: "篩選",
116
+ linkedFilter: "{title}:{value}",
117
+ clearFilters: "清除篩選",
118
+ source: "資料來源",
119
+ noSource: "不使用資料來源",
120
+ field: "欄位",
121
+ value: "數值",
122
+ prefix: "前綴",
123
+ suffix: "後綴",
124
+ precision: "小數位數",
125
+ trend: "迷你圖欄位",
126
+ delta: "變化率欄位",
127
+ deltaText: "較上期 {value}",
128
+ text: "文字",
129
+ textSize: "字號",
130
+ sizeSmall: "小",
131
+ sizeMedium: "中",
132
+ sizeLarge: "大",
133
+ columns: "欄",
134
+ columnTitle: "{field} 的標題",
135
+ chartKind: "圖表",
136
+ chartLine: "折線圖",
137
+ chartArea: "面積圖",
138
+ chartBar: "長條圖",
139
+ chartPie: "圓餅圖",
140
+ xField: "分類或時間",
141
+ yFields: "數值",
142
+ stacked: "堆疊",
143
+ horizontal: "橫向",
144
+ chartFilter: "點擊時篩選",
145
+ chartFilterHint: "點圖表裡的一項時,用這個名字篩選其他格子;留空則不篩選",
146
+ pivotFilter: "點擊儲存格時,依其所在的分組篩選其他格子"
147
+ };
148
+ var en = {
149
+ layout: "Grid layout",
150
+ item: "tile",
151
+ itemHint: "Press Enter to pick up, then arrow keys to move and Shift with arrow keys to resize",
152
+ locked: "{item} is locked and can’t be moved",
153
+ position: "column {x}, row {y}, {w} columns wide, {h} rows high",
154
+ order: "{n} of {count}",
155
+ grabbed: "Picked up {item}, {position}. Arrow keys move, Shift with arrow keys resizes, Enter puts down, Escape cancels",
156
+ dropped: "Put down {item}, {position}",
157
+ cancelled: "Cancelled, {item} is back where it was",
158
+ resize: "Resize",
159
+ dashboard: "Dashboard",
160
+ widgetMenu: "Widget actions",
161
+ settings: "Settings",
162
+ fullscreen: "View full screen",
163
+ export: "Export",
164
+ exportFailed: "Couldn't export {name}: {reason}",
165
+ exported: "Exported {name}",
166
+ nothingToExport: "There is no data to export",
167
+ duplicate: "Duplicate",
168
+ remove: "Remove",
169
+ settingsTitle: "{title} settings",
170
+ titleField: "Title",
171
+ added: "Added {item}",
172
+ removed: "Removed {item}",
173
+ unknownType: "No widget type “{type}” is registered",
174
+ loading: "Loading",
175
+ error: "Couldn’t load",
176
+ empty: "No data",
177
+ retry: "Retry",
178
+ emptyTitle: "No widgets yet",
179
+ emptyHint: "Drag one in from the list, or click to add it",
180
+ palette: "Add widget",
181
+ paletteItem: "Add {label}",
182
+ filteredBy: "Filtered by {value}",
183
+ peerMoving: "{name} is moving it",
184
+ peerResizing: "{name} is resizing it",
185
+ peerSettings: "{name} is changing its settings",
186
+ clearFilter: "Clear filter: {value}",
187
+ filterBar: "Filters",
188
+ linkedFilter: "{title}: {value}",
189
+ clearFilters: "Clear filters",
190
+ source: "Source",
191
+ noSource: "No source",
192
+ field: "Field",
193
+ value: "Value",
194
+ prefix: "Prefix",
195
+ suffix: "Suffix",
196
+ precision: "Decimal places",
197
+ trend: "Sparkline field",
198
+ delta: "Change field",
199
+ deltaText: "{value} vs. last period",
200
+ text: "Text",
201
+ textSize: "Size",
202
+ sizeSmall: "Small",
203
+ sizeMedium: "Medium",
204
+ sizeLarge: "Large",
205
+ columns: "Columns",
206
+ columnTitle: "Title of {field}",
207
+ chartKind: "Chart",
208
+ chartLine: "Line",
209
+ chartArea: "Area",
210
+ chartBar: "Bar",
211
+ chartPie: "Pie",
212
+ xField: "Category or time",
213
+ yFields: "Values",
214
+ stacked: "Stacked",
215
+ horizontal: "Horizontal",
216
+ chartFilter: "Filter on click",
217
+ chartFilterHint: "Clicking an item filters the other widgets by this name; leave empty to not filter",
218
+ pivotFilter: "Clicking a cell filters the other widgets by its groups"
219
+ };
220
+ var dashboardLocales = {
221
+ "zh-CN": zhCN,
222
+ "zh-TW": zhTW,
223
+ en
224
+ };
225
+ /**
226
+ * The dashboard's texts, picked by the name of DouUI's current locale.
227
+ * Pass `messages` to override any of them.
228
+ */
229
+ function useDashboardMessages(override) {
230
+ const { locale } = useLocale();
231
+ return computed(() => {
232
+ const name = locale.value.name;
233
+ const base = dashboardLocales[name] ?? dashboardLocales[name.split("-")[0]] ?? (name.startsWith("zh") ? zhCN : en);
234
+ const extra = toValue(override);
235
+ return extra ? {
236
+ ...base,
237
+ ...extra
238
+ } : base;
239
+ });
240
+ }
241
+ /** Fills `{name}` placeholders. */
242
+ var format = (text, params) => text.replace(/\{(\w+)\}/g, (match, key) => String(params[key] ?? match));
243
+ export { dashboardLocales, format, useDashboardMessages };
244
+
245
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","names":[],"sources":["../src/locale.ts"],"sourcesContent":["import { useLocale } from 'dou-ui'\nimport { computed, toValue, type MaybeRefOrGetter } from 'vue'\n\nexport interface DashboardMessages {\n /** The grid layout's accessible name. */\n layout: string\n /** What an item of the grid is called by a screen reader. */\n item: string\n /** Read after an item's name while the layout can be edited. */\n itemHint: string\n /** An item that can't be moved: `{item}`. */\n locked: string\n /** An item's place: `{x}` `{y}` (from 1), `{w}` `{h}` (in columns and rows). */\n position: string\n /** An item's place when the grid has one column: `{n}` of `{count}` (from 1). */\n order: string\n /** An item picked up with the keyboard: `{item}` and `{position}`. */\n grabbed: string\n /** An item put down, with the keyboard or the pointer: `{item}` and `{position}`. */\n dropped: string\n /** A move or resize undone with Escape (or a drop outside the grid): `{item}`. */\n cancelled: string\n /** The handle in an item's corner. */\n resize: string\n /** The dashboard's accessible name. */\n dashboard: string\n /** The menu button in a widget's title bar. */\n widgetMenu: string\n /** Menu items. */\n settings: string\n fullscreen: string\n /** The menu of file types a widget's content can be exported as. */\n export: string\n /** A failed export, over the widget's content: `{name}` (the file), `{reason}`. */\n exportFailed: string\n /** Read out once the file is saved: `{name}`. */\n exported: string\n /** Why a widget can't be exported: it has no data, such as a chart without its fields. */\n nothingToExport: string\n duplicate: string\n remove: string\n /** The settings drawer's title: `{title}`. */\n settingsTitle: string\n /** The title field in the settings drawer. */\n titleField: string\n /** Read when a widget is added, copied or removed: `{item}`. */\n added: string\n removed: string\n /** A widget whose type isn't registered: `{type}`. */\n unknownType: string\n /** A widget's status. */\n loading: string\n error: string\n empty: string\n retry: string\n /** A dashboard without widgets, while editing. */\n emptyTitle: string\n emptyHint: string\n /** The list of widgets to add. */\n palette: string\n /** A widget in that list: `{label}`. */\n paletteItem: string\n /** In the title bar of a widget that set a filter: `{value}`. */\n filteredBy: string\n peerMoving: string\n peerResizing: string\n peerSettings: string\n /** The button clearing that filter: `{value}`. */\n clearFilter: string\n /** The filter bar's accessible name. */\n filterBar: string\n /** A filter set by a widget, in the filter bar: `{title}` and `{value}`. */\n linkedFilter: string\n /** Clears every filter. */\n clearFilters: string\n /** Settings of the built-in widgets. */\n source: string\n noSource: string\n field: string\n value: string\n prefix: string\n suffix: string\n precision: string\n trend: string\n delta: string\n /** The change under a number: `{value}`, e.g. `+12.5%`. */\n deltaText: string\n text: string\n textSize: string\n sizeSmall: string\n sizeMedium: string\n sizeLarge: string\n columns: string\n /** The title of a table column, while it has none: `{field}`. */\n columnTitle: string\n chartKind: string\n chartLine: string\n chartArea: string\n chartBar: string\n chartPie: string\n xField: string\n yFields: string\n stacked: string\n horizontal: string\n /** The filter set by clicking a chart. */\n chartFilter: string\n chartFilterHint: string\n /** Whether clicking a pivot table's cell filters the other widgets. */\n pivotFilter: string\n}\n\nconst zhCN: DashboardMessages = {\n layout: '网格布局',\n item: '格子',\n itemHint: '按 Enter 拿起,再用方向键移动、Shift 加方向键调整大小',\n locked: '{item} 已锁定,不能移动',\n position: '第 {x} 列第 {y} 行,宽 {w} 列,高 {h} 行',\n order: '第 {n} 个,共 {count} 个',\n grabbed: '已拿起 {item},{position}。方向键移动,Shift 加方向键调整大小,Enter 放下,Esc 取消',\n dropped: '已放下 {item},{position}',\n cancelled: '已取消,{item} 回到原处',\n resize: '调整大小',\n dashboard: '仪表盘',\n widgetMenu: '格子操作',\n settings: '设置',\n fullscreen: '全屏查看',\n export: '导出',\n exportFailed: '无法导出 {name}:{reason}',\n exported: '已导出 {name}',\n nothingToExport: '没有可导出的数据',\n duplicate: '复制一份',\n remove: '删除',\n settingsTitle: '{title}的设置',\n titleField: '标题',\n added: '已添加 {item}',\n removed: '已删除 {item}',\n unknownType: '没有注册类型为 {type} 的格子',\n loading: '加载中',\n error: '加载失败',\n empty: '暂无数据',\n retry: '重试',\n emptyTitle: '还没有格子',\n emptyHint: '从列表里拖进来,或点一下添加',\n palette: '添加格子',\n paletteItem: '添加{label}',\n filteredBy: '已按 {value} 筛选',\n peerMoving: '{name} 正在移动',\n peerResizing: '{name} 正在调整大小',\n peerSettings: '{name} 正在修改设置',\n clearFilter: '清除筛选:{value}',\n filterBar: '筛选',\n linkedFilter: '{title}:{value}',\n clearFilters: '清除筛选',\n source: '数据源',\n noSource: '不使用数据源',\n field: '字段',\n value: '数值',\n prefix: '前缀',\n suffix: '后缀',\n precision: '小数位数',\n trend: '迷你图字段',\n delta: '变化率字段',\n deltaText: '较上期 {value}',\n text: '文字',\n textSize: '字号',\n sizeSmall: '小',\n sizeMedium: '中',\n sizeLarge: '大',\n columns: '列',\n columnTitle: '{field} 的标题',\n chartKind: '图表',\n chartLine: '折线图',\n chartArea: '面积图',\n chartBar: '柱状图',\n chartPie: '饼图',\n xField: '分类或时间',\n yFields: '数值',\n stacked: '堆叠',\n horizontal: '横向',\n chartFilter: '点击时筛选',\n chartFilterHint: '点图表里的一项时,用这个名字筛选其他格子;留空则不筛选',\n pivotFilter: '点击单元格时,按它所在的分组筛选其他格子',\n}\n\nconst zhTW: DashboardMessages = {\n layout: '網格版面',\n item: '格子',\n itemHint: '按 Enter 拿起,再用方向鍵移動、Shift 加方向鍵調整大小',\n locked: '{item} 已鎖定,無法移動',\n position: '第 {x} 欄第 {y} 列,寬 {w} 欄,高 {h} 列',\n order: '第 {n} 個,共 {count} 個',\n grabbed: '已拿起 {item},{position}。方向鍵移動,Shift 加方向鍵調整大小,Enter 放下,Esc 取消',\n dropped: '已放下 {item},{position}',\n cancelled: '已取消,{item} 回到原處',\n resize: '調整大小',\n dashboard: '儀表板',\n widgetMenu: '格子操作',\n settings: '設定',\n fullscreen: '全螢幕檢視',\n export: '匯出',\n exportFailed: '無法匯出 {name}:{reason}',\n exported: '已匯出 {name}',\n nothingToExport: '沒有可匯出的資料',\n duplicate: '複製一份',\n remove: '刪除',\n settingsTitle: '{title}的設定',\n titleField: '標題',\n added: '已新增 {item}',\n removed: '已刪除 {item}',\n unknownType: '沒有註冊類型為 {type} 的格子',\n loading: '載入中',\n error: '載入失敗',\n empty: '暫無資料',\n retry: '重試',\n emptyTitle: '還沒有格子',\n emptyHint: '從清單拖進來,或點一下新增',\n palette: '新增格子',\n paletteItem: '新增{label}',\n filteredBy: '已按 {value} 篩選',\n peerMoving: '{name} 正在移動',\n peerResizing: '{name} 正在調整大小',\n peerSettings: '{name} 正在修改設定',\n clearFilter: '清除篩選:{value}',\n filterBar: '篩選',\n linkedFilter: '{title}:{value}',\n clearFilters: '清除篩選',\n source: '資料來源',\n noSource: '不使用資料來源',\n field: '欄位',\n value: '數值',\n prefix: '前綴',\n suffix: '後綴',\n precision: '小數位數',\n trend: '迷你圖欄位',\n delta: '變化率欄位',\n deltaText: '較上期 {value}',\n text: '文字',\n textSize: '字號',\n sizeSmall: '小',\n sizeMedium: '中',\n sizeLarge: '大',\n columns: '欄',\n columnTitle: '{field} 的標題',\n chartKind: '圖表',\n chartLine: '折線圖',\n chartArea: '面積圖',\n chartBar: '長條圖',\n chartPie: '圓餅圖',\n xField: '分類或時間',\n yFields: '數值',\n stacked: '堆疊',\n horizontal: '橫向',\n chartFilter: '點擊時篩選',\n chartFilterHint: '點圖表裡的一項時,用這個名字篩選其他格子;留空則不篩選',\n pivotFilter: '點擊儲存格時,依其所在的分組篩選其他格子',\n}\n\nconst en: DashboardMessages = {\n layout: 'Grid layout',\n item: 'tile',\n itemHint: 'Press Enter to pick up, then arrow keys to move and Shift with arrow keys to resize',\n locked: '{item} is locked and can’t be moved',\n position: 'column {x}, row {y}, {w} columns wide, {h} rows high',\n order: '{n} of {count}',\n grabbed:\n 'Picked up {item}, {position}. Arrow keys move, Shift with arrow keys resizes, Enter puts down, Escape cancels',\n dropped: 'Put down {item}, {position}',\n cancelled: 'Cancelled, {item} is back where it was',\n resize: 'Resize',\n dashboard: 'Dashboard',\n widgetMenu: 'Widget actions',\n settings: 'Settings',\n fullscreen: 'View full screen',\n export: 'Export',\n exportFailed: \"Couldn't export {name}: {reason}\",\n exported: 'Exported {name}',\n nothingToExport: 'There is no data to export',\n duplicate: 'Duplicate',\n remove: 'Remove',\n settingsTitle: '{title} settings',\n titleField: 'Title',\n added: 'Added {item}',\n removed: 'Removed {item}',\n unknownType: 'No widget type “{type}” is registered',\n loading: 'Loading',\n error: 'Couldn’t load',\n empty: 'No data',\n retry: 'Retry',\n emptyTitle: 'No widgets yet',\n emptyHint: 'Drag one in from the list, or click to add it',\n palette: 'Add widget',\n paletteItem: 'Add {label}',\n filteredBy: 'Filtered by {value}',\n peerMoving: '{name} is moving it',\n peerResizing: '{name} is resizing it',\n peerSettings: '{name} is changing its settings',\n clearFilter: 'Clear filter: {value}',\n filterBar: 'Filters',\n linkedFilter: '{title}: {value}',\n clearFilters: 'Clear filters',\n source: 'Source',\n noSource: 'No source',\n field: 'Field',\n value: 'Value',\n prefix: 'Prefix',\n suffix: 'Suffix',\n precision: 'Decimal places',\n trend: 'Sparkline field',\n delta: 'Change field',\n deltaText: '{value} vs. last period',\n text: 'Text',\n textSize: 'Size',\n sizeSmall: 'Small',\n sizeMedium: 'Medium',\n sizeLarge: 'Large',\n columns: 'Columns',\n columnTitle: 'Title of {field}',\n chartKind: 'Chart',\n chartLine: 'Line',\n chartArea: 'Area',\n chartBar: 'Bar',\n chartPie: 'Pie',\n xField: 'Category or time',\n yFields: 'Values',\n stacked: 'Stacked',\n horizontal: 'Horizontal',\n chartFilter: 'Filter on click',\n chartFilterHint:\n 'Clicking an item filters the other widgets by this name; leave empty to not filter',\n pivotFilter: 'Clicking a cell filters the other widgets by its groups',\n}\n\nexport const dashboardLocales: Record<string, DashboardMessages> = {\n 'zh-CN': zhCN,\n 'zh-TW': zhTW,\n en,\n}\n\nexport type DashboardMessagesOverride = Partial<DashboardMessages>\n\n/**\n * The dashboard's texts, picked by the name of DouUI's current locale.\n * Pass `messages` to override any of them.\n */\nexport function useDashboardMessages(\n override?: MaybeRefOrGetter<DashboardMessagesOverride | undefined>,\n) {\n const { locale } = useLocale()\n return computed<DashboardMessages>(() => {\n const name = locale.value.name\n const base =\n dashboardLocales[name] ??\n dashboardLocales[name.split('-')[0]!] ??\n (name.startsWith('zh') ? zhCN : en)\n const extra = toValue(override)\n return extra ? { ...base, ...extra } : base\n })\n}\n\n/** Fills `{name}` placeholders. */\nexport const format = (text: string, params: Record<string, string | number>) =>\n text.replace(/\\{(\\w+)\\}/g, (match, key: string) => String(params[key] ?? match))\n"],"mappings":";;;AA+GA,IAAM,OAA0B;CAC9B,QAAQ;CACR,MAAM;CACN,UAAU;CACV,QAAQ;CACR,UAAU;CACV,OAAO;CACP,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,cAAc;CACd,UAAU;CACV,iBAAiB;CACjB,WAAW;CACX,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,OAAO;CACP,SAAS;CACT,aAAa;CACb,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;CACP,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,cAAc;CACd,aAAa;CACb,WAAW;CACX,cAAc;CACd,cAAc;CACd,QAAQ;CACR,UAAU;CACV,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,OAAO;CACP,WAAW;CACX,MAAM;CACN,UAAU;CACV,WAAW;CACX,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,WAAW;CACX,WAAW;CACX,WAAW;CACX,UAAU;CACV,UAAU;CACV,QAAQ;CACR,SAAS;CACT,SAAS;CACT,YAAY;CACZ,aAAa;CACb,iBAAiB;CACjB,aAAa;AACf;AAEA,IAAM,OAA0B;CAC9B,QAAQ;CACR,MAAM;CACN,UAAU;CACV,QAAQ;CACR,UAAU;CACV,OAAO;CACP,SAAS;CACT,SAAS;CACT,WAAW;CACX,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,cAAc;CACd,UAAU;CACV,iBAAiB;CACjB,WAAW;CACX,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,OAAO;CACP,SAAS;CACT,aAAa;CACb,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;CACP,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,cAAc;CACd,aAAa;CACb,WAAW;CACX,cAAc;CACd,cAAc;CACd,QAAQ;CACR,UAAU;CACV,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,OAAO;CACP,WAAW;CACX,MAAM;CACN,UAAU;CACV,WAAW;CACX,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,WAAW;CACX,WAAW;CACX,WAAW;CACX,UAAU;CACV,UAAU;CACV,QAAQ;CACR,SAAS;CACT,SAAS;CACT,YAAY;CACZ,aAAa;CACb,iBAAiB;CACjB,aAAa;AACf;AAEA,IAAM,KAAwB;CAC5B,QAAQ;CACR,MAAM;CACN,UAAU;CACV,QAAQ;CACR,UAAU;CACV,OAAO;CACP,SACE;CACF,SAAS;CACT,WAAW;CACX,QAAQ;CACR,WAAW;CACX,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,QAAQ;CACR,cAAc;CACd,UAAU;CACV,iBAAiB;CACjB,WAAW;CACX,QAAQ;CACR,eAAe;CACf,YAAY;CACZ,OAAO;CACP,SAAS;CACT,aAAa;CACb,SAAS;CACT,OAAO;CACP,OAAO;CACP,OAAO;CACP,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,cAAc;CACd,aAAa;CACb,WAAW;CACX,cAAc;CACd,cAAc;CACd,QAAQ;CACR,UAAU;CACV,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,WAAW;CACX,OAAO;CACP,OAAO;CACP,WAAW;CACX,MAAM;CACN,UAAU;CACV,WAAW;CACX,YAAY;CACZ,WAAW;CACX,SAAS;CACT,aAAa;CACb,WAAW;CACX,WAAW;CACX,WAAW;CACX,UAAU;CACV,UAAU;CACV,QAAQ;CACR,SAAS;CACT,SAAS;CACT,YAAY;CACZ,aAAa;CACb,iBACE;CACF,aAAa;AACf;AAEA,IAAa,mBAAsD;CACjE,SAAS;CACT,SAAS;CACT;AACF;;;;;AAQA,SAAgB,qBACd,UACA;CACA,MAAM,EAAE,WAAW,UAAU;CAC7B,OAAO,eAAkC;EACvC,MAAM,OAAO,OAAO,MAAM;EAC1B,MAAM,OACJ,iBAAiB,SACjB,iBAAiB,KAAK,MAAM,GAAG,CAAC,CAAC,QAChC,KAAK,WAAW,IAAI,IAAI,OAAO;EAClC,MAAM,QAAQ,QAAQ,QAAQ;EAC9B,OAAO,QAAQ;GAAE,GAAG;GAAM,GAAG;EAAM,IAAI;CACzC,CAAC;AACH;;AAGA,IAAa,UAAU,MAAc,WACnC,KAAK,QAAQ,eAAe,OAAO,QAAgB,OAAO,OAAO,QAAQ,KAAK,CAAC"}
@@ -0,0 +1,47 @@
1
+ import { defineDashboardWidget } from "../widget/define.js";
2
+ import pivot_default from "./pivot.js";
3
+ import pivot_settings_default from "./pivot-settings.js";
4
+ import { defineComponent, h } from "vue";
5
+ import { TablePivotIcon } from "@dou-ui/icons";
6
+ // src/pivot/index.ts
7
+ /**
8
+ * A pivot table of a source's records, drawn with `@dou-ui/pivot`; its
9
+ * settings lay the fields out, and clicking a cell can filter the other
10
+ * widgets. Needs `@dou-ui/pivot` and its styles.
11
+ */
12
+ function pivotWidget(options = {}) {
13
+ const { fields, ...overrides } = options;
14
+ return defineDashboardWidget({
15
+ type: "pivot",
16
+ label: "透视表",
17
+ icon: TablePivotIcon,
18
+ size: {
19
+ w: 6,
20
+ h: 5,
21
+ minW: 4,
22
+ minH: 3
23
+ },
24
+ defaultProps: { config: {} },
25
+ component: defineComponent({
26
+ name: "DouDashboardPivot",
27
+ setup: () => () => h(pivot_default, { fields })
28
+ }),
29
+ settings: defineComponent({
30
+ name: "DouDashboardPivotSettingsFor",
31
+ props: { modelValue: {
32
+ type: Object,
33
+ required: true
34
+ } },
35
+ emits: ["update:modelValue"],
36
+ setup: (props, { emit }) => () => h(pivot_settings_default, {
37
+ fields,
38
+ modelValue: props.modelValue,
39
+ "onUpdate:modelValue": (value) => emit("update:modelValue", value)
40
+ })
41
+ }),
42
+ ...overrides
43
+ });
44
+ }
45
+ export { pivotWidget };
46
+
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["Pivot","PivotSettings"],"sources":["../../src/pivot/index.ts"],"sourcesContent":["import { TablePivotIcon } from '@dou-ui/icons'\nimport type { PivotField } from '@dou-ui/pivot'\nimport { defineComponent, h } from 'vue'\nimport { defineDashboardWidget } from '../widget/define'\nimport type { WidgetOverrides } from '../widgets'\nimport Pivot from './pivot.vue'\nimport PivotSettings from './pivot-settings.vue'\nimport type { PivotWidgetProps } from './types'\n\nexport type { PivotWidgetProps } from './types'\n\nexport interface PivotWidgetOptions extends WidgetOverrides<PivotWidgetProps> {\n /** What the fields hold and how to show them, as `DouPivot`'s `fields`; worked out from the records when left out. */\n fields?: readonly PivotField[]\n}\n\n/**\n * A pivot table of a source's records, drawn with `@dou-ui/pivot`; its\n * settings lay the fields out, and clicking a cell can filter the other\n * widgets. Needs `@dou-ui/pivot` and its styles.\n */\nexport function pivotWidget(options: PivotWidgetOptions = {}) {\n const { fields, ...overrides } = options\n return defineDashboardWidget<PivotWidgetProps>({\n type: 'pivot',\n label: '透视表',\n icon: TablePivotIcon,\n size: { w: 6, h: 5, minW: 4, minH: 3 },\n defaultProps: { config: {} },\n component: defineComponent({\n name: 'DouDashboardPivot',\n setup: () => () => h(Pivot, { fields }),\n }),\n settings: defineComponent({\n name: 'DouDashboardPivotSettingsFor',\n props: { modelValue: { type: Object, required: true } },\n emits: ['update:modelValue'],\n setup:\n (props, { emit }) =>\n () =>\n h(PivotSettings, {\n fields,\n modelValue: props.modelValue as PivotWidgetProps,\n 'onUpdate:modelValue': (value: PivotWidgetProps) => emit('update:modelValue', value),\n }),\n }),\n ...overrides,\n })\n}\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,YAAY,UAA8B,CAAC,GAAG;CAC5D,MAAM,EAAE,QAAQ,GAAG,cAAc;CACjC,OAAO,sBAAwC;EAC7C,MAAM;EACN,OAAO;EACP,MAAM;EACN,MAAM;GAAE,GAAG;GAAG,GAAG;GAAG,MAAM;GAAG,MAAM;EAAE;EACrC,cAAc,EAAE,QAAQ,CAAC,EAAE;EAC3B,WAAW,gBAAgB;GACzB,MAAM;GACN,mBAAmB,EAAEA,eAAO,EAAE,OAAO,CAAC;EACxC,CAAC;EACD,UAAU,gBAAgB;GACxB,MAAM;GACN,OAAO,EAAE,YAAY;IAAE,MAAM;IAAQ,UAAU;GAAK,EAAE;GACtD,OAAO,CAAC,mBAAmB;GAC3B,QACG,OAAO,EAAE,iBAER,EAAEC,wBAAe;IACf;IACA,YAAY,MAAM;IAClB,wBAAwB,UAA4B,KAAK,qBAAqB,KAAK;GACrF,CAAC;EACP,CAAC;EACD,GAAG;CACL,CAAC;AACH"}
@@ -0,0 +1,6 @@
1
+ import pivot_settings_vue_vue_type_script_setup_true_lang_default from "./pivot-settings.vue_vue_type_script_setup_true_lang.js";
2
+ // src/pivot/pivot-settings.vue
3
+ var pivot_settings_default = pivot_settings_vue_vue_type_script_setup_true_lang_default;
4
+ export { pivot_settings_default as default };
5
+
6
+ //# sourceMappingURL=pivot-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-settings.js","names":["_sfc_main"],"sources":["../../src/pivot/pivot-settings.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivotFields } from '@dou-ui/pivot'\nimport type { PivotField } from '@dou-ui/pivot'\nimport { DouSwitch } from 'dou-ui'\nimport { computed } from 'vue'\nimport { useDashboardMessages } from '../locale'\nimport { useDashboardWidget } from '../widget/context'\nimport SettingsField from '../widgets/settings-field.vue'\nimport { rowsOf } from '../widgets/shared'\nimport SourceField from '../widgets/source-field.vue'\nimport type { PivotWidgetProps } from './types'\n\ndefineOptions({ name: 'DouDashboardPivotSettings' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\nconst model = defineModel<PivotWidgetProps>({ required: true })\nconst messages = useDashboardMessages()\nconst { data } = useDashboardWidget()\nconst rows = computed(() => rowsOf(data.value, model.value.path))\nconst set = (patch: Partial<PivotWidgetProps>) => (model.value = { ...model.value, ...patch })\n</script>\n\n<template>\n <div class=\"dou-dashboard__settings\">\n <SourceField :model-value=\"model.source\" @update:model-value=\"(source) => set({ source })\" />\n <SettingsField v-if=\"rows.length\" :label=\"messages.field\">\n <DouPivotFields\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"model.config\"\n :drawer=\"false\"\n @update:config=\"(config) => set({ config })\"\n />\n </SettingsField>\n <DouSwitch\n :model-value=\"!!model.filter\"\n @update:model-value=\"(filter) => set({ filter: filter || undefined })\"\n >\n {{ messages.pivotFilter }}\n </DouSwitch>\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { useDashboardMessages } from "../locale.js";
2
+ import { useDashboardWidget } from "../widget/context.js";
3
+ import { rowsOf } from "../widgets/shared.js";
4
+ import settings_field_default from "../widgets/settings-field.js";
5
+ import source_field_default from "../widgets/source-field.js";
6
+ import { DouSwitch } from "dou-ui";
7
+ import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
8
+ import { DouPivotFields } from "@dou-ui/pivot";
9
+ // src/pivot/pivot-settings.vue?vue&type=script&setup=true&lang.ts
10
+ var _hoisted_1 = { class: "dou-dashboard__settings" };
11
+ var pivot_settings_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
12
+ name: "DouDashboardPivotSettings",
13
+ __name: "pivot-settings",
14
+ props: /*@__PURE__*/ mergeModels({ fields: {} }, {
15
+ "modelValue": { required: true },
16
+ "modelModifiers": {}
17
+ }),
18
+ emits: ["update:modelValue"],
19
+ setup(__props) {
20
+ const model = useModel(__props, "modelValue");
21
+ const messages = useDashboardMessages();
22
+ const { data } = useDashboardWidget();
23
+ const rows = computed(() => rowsOf(data.value, model.value.path));
24
+ const set = (patch) => model.value = {
25
+ ...model.value,
26
+ ...patch
27
+ };
28
+ return (_ctx, _cache) => {
29
+ return openBlock(), createElementBlock("div", _hoisted_1, [
30
+ createVNode(source_field_default, {
31
+ "model-value": model.value.source,
32
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (source) => set({ source }))
33
+ }, null, 8, ["model-value"]),
34
+ rows.value.length ? (openBlock(), createBlock(settings_field_default, {
35
+ key: 0,
36
+ label: unref(messages).field
37
+ }, {
38
+ default: withCtx(() => [createVNode(unref(DouPivotFields), {
39
+ data: rows.value,
40
+ fields: __props.fields,
41
+ config: model.value.config,
42
+ drawer: false,
43
+ "onUpdate:config": _cache[1] || (_cache[1] = (config) => set({ config }))
44
+ }, null, 8, [
45
+ "data",
46
+ "fields",
47
+ "config"
48
+ ])]),
49
+ _: 1
50
+ }, 8, ["label"])) : createCommentVNode("", true),
51
+ createVNode(unref(DouSwitch), {
52
+ "model-value": !!model.value.filter,
53
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = (filter) => set({ filter: filter || void 0 }))
54
+ }, {
55
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).pivotFilter), 1)]),
56
+ _: 1
57
+ }, 8, ["model-value"])
58
+ ]);
59
+ };
60
+ }
61
+ });
62
+ export { pivot_settings_vue_vue_type_script_setup_true_lang_default as default };
63
+
64
+ //# sourceMappingURL=pivot-settings.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot-settings.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createElementBlock","_createVNode","SourceField","_createBlock","SettingsField","_unref","_withCtx","_createCommentVNode","_createTextVNode","_toDisplayString"],"sources":["../../src/pivot/pivot-settings.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivotFields } from '@dou-ui/pivot'\nimport type { PivotField } from '@dou-ui/pivot'\nimport { DouSwitch } from 'dou-ui'\nimport { computed } from 'vue'\nimport { useDashboardMessages } from '../locale'\nimport { useDashboardWidget } from '../widget/context'\nimport SettingsField from '../widgets/settings-field.vue'\nimport { rowsOf } from '../widgets/shared'\nimport SourceField from '../widgets/source-field.vue'\nimport type { PivotWidgetProps } from './types'\n\ndefineOptions({ name: 'DouDashboardPivotSettings' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\nconst model = defineModel<PivotWidgetProps>({ required: true })\nconst messages = useDashboardMessages()\nconst { data } = useDashboardWidget()\nconst rows = computed(() => rowsOf(data.value, model.value.path))\nconst set = (patch: Partial<PivotWidgetProps>) => (model.value = { ...model.value, ...patch })\n</script>\n\n<template>\n <div class=\"dou-dashboard__settings\">\n <SourceField :model-value=\"model.source\" @update:model-value=\"(source) => set({ source })\" />\n <SettingsField v-if=\"rows.length\" :label=\"messages.field\">\n <DouPivotFields\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"model.config\"\n :drawer=\"false\"\n @update:config=\"(config) => set({ config })\"\n />\n </SettingsField>\n <DouSwitch\n :model-value=\"!!model.filter\"\n @update:model-value=\"(filter) => set({ filter: filter || undefined })\"\n >\n {{ messages.pivotFilter }}\n </DouSwitch>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EAeA,MAAM,QAAQA,SAA6B,SAAA,YAAmB;EAC9D,MAAM,WAAW,qBAAqB;EACtC,MAAM,EAAE,SAAS,mBAAmB;EACpC,MAAM,OAAO,eAAe,OAAO,KAAK,OAAO,MAAM,MAAM,IAAI,CAAC;EAChE,MAAM,OAAO,UAAsC,MAAM,QAAQ;GAAE,GAAG,MAAM;GAAO,GAAG;EAAM;;GAI1F,OAAAC,UAAA,GAAAC,mBAiBM,OAjBN,YAiBM;IAhBJC,YAA6FC,sBAAA;KAA/E,eAAa,MAAA,MAAM;KAAS,uBAAkB,OAAA,OAAA,OAAA,MAAG,WAAW,IAAG,EAAG,OAAM,CAAA;;IACjE,KAAA,MAAK,UAA1BH,UAAA,GAAAI,YAQgBC,wBAAA;;KARmB,OAAOC,MAAA,QAAA,CAAQ,CAAC;;KACjD,SAAAC,cAME,CANFL,YAMEI,MAAA,cAAA,GAAA;MALC,MAAM,KAAA;MACN,QAAQ,QAAA;MACR,QAAQ,MAAA,MAAM;MACd,QAAQ;MACR,mBAAa,OAAA,OAAA,OAAA,MAAG,WAAW,IAAG,EAAG,OAAM,CAAA;;;;;;;;IAG5CJ,YAKYI,MAAA,SAAA,GAAA;KAJT,eAAW,CAAA,CAAI,MAAA,MAAM;KACrB,uBAAkB,OAAA,OAAA,OAAA,MAAG,WAAW,IAAG,EAAA,QAAW,UAAU,KAAA,EAAS,CAAA;;KAElE,SAAAC,cAA0B,CAAvBE,gBAAAC,gBAAAJ,MAAA,QAAA,CAAQ,CAAC,WAAW,GAAA,CAAA,C"}
@@ -0,0 +1,6 @@
1
+ import pivot_vue_vue_type_script_setup_true_lang_default from "./pivot.vue_vue_type_script_setup_true_lang.js";
2
+ // src/pivot/pivot.vue
3
+ var pivot_default = pivot_vue_vue_type_script_setup_true_lang_default;
4
+ export { pivot_default as default };
5
+
6
+ //# sourceMappingURL=pivot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot.js","names":["_sfc_main"],"sources":["../../src/pivot/pivot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivot } from '@dou-ui/pivot'\nimport type {\n PivotCellEvent,\n PivotConfig,\n PivotDimension,\n PivotExpose,\n PivotField,\n} from '@dou-ui/pivot'\nimport { computed, shallowRef, watch } from 'vue'\nimport { useDashboardWidget } from '../widget/context'\nimport { filterValueOf, rowsOf } from '../widgets/shared'\nimport type { PivotWidgetProps } from './types'\n\ndefineOptions({ name: 'DouDashboardPivotWidget' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\n\nconst { props, data, size, setFilter, ownFilters, editing, setProps, setWorkbook } =\n useDashboardWidget<PivotWidgetProps>()\nconst pivot = shallowRef<PivotExpose>()\n// the export menu writes the table as it shows: merged heads, totals, number formats\nsetWorkbook(() => pivot.value?.toSheet({ name: '' }))\nconst rows = computed(() => rowsOf(data.value, props.value.path))\n// sorting in the table works while viewing too; only while editing is it saved\nconst config = shallowRef<PivotConfig | undefined>(props.value.config)\nwatch(\n () => props.value.config,\n (next) => (config.value = next),\n)\nfunction onConfig(next: PivotConfig) {\n config.value = next\n if (editing.value) setProps({ config: next }, { group: 'pivot-config' })\n}\nconst nameOf = (dimension: PivotDimension) =>\n typeof dimension === 'string' ? dimension : dimension.field\n\n/** The groups this widget's filters picked, marked in the table. */\nfunction pathOf(dimensions: readonly PivotDimension[] = [], filters: Record<string, unknown>) {\n const path: unknown[] = []\n for (const dimension of dimensions) {\n const value = filters[nameOf(dimension)]\n if (value === undefined) break\n path.push(value)\n }\n return path\n}\nconst highlight = computed(() => {\n if (!props.value.filter) return undefined\n const filters = ownFilters.value\n return {\n row: pathOf(config.value?.rows, filters),\n column: pathOf(config.value?.columns, filters),\n }\n})\n\n/** One filter per field of a group's path; the fields past its end are cleared. */\nfunction apply(\n dimensions: readonly PivotDimension[] = [],\n path: readonly unknown[],\n labels: string[],\n) {\n dimensions.forEach((dimension, i) =>\n i < path.length\n ? setFilter(nameOf(dimension), filterValueOf(path[i]), { label: labels[i] })\n : setFilter(nameOf(dimension), undefined),\n )\n}\n\n/** Sets one filter per field of the clicked cell's groups; a total clears the deeper ones. */\nfunction onCell(cell: PivotCellEvent) {\n if (!props.value.filter) return\n const { rows: rowDims, columns: columnDims } = config.value ?? {}\n apply(rowDims, cell.row, cell.labels.row)\n apply(columnDims, cell.column, cell.labels.column)\n}\n</script>\n\n<template>\n <DouPivot\n ref=\"pivot\"\n class=\"dou-dashboard-pivot\"\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"config\"\n :highlight=\"highlight\"\n size=\"sm\"\n :max-height=\"size.height.value || undefined\"\n @update:config=\"onConfig\"\n @cell-click=\"onCell\"\n />\n</template>\n"],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { useDashboardWidget } from "../widget/context.js";
2
+ import { filterValueOf, rowsOf } from "../widgets/shared.js";
3
+ import { computed, createBlock, defineComponent, openBlock, shallowRef, unref, watch } from "vue";
4
+ import { DouPivot } from "@dou-ui/pivot";
5
+ // src/pivot/pivot.vue?vue&type=script&setup=true&lang.ts
6
+ var pivot_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
7
+ name: "DouDashboardPivotWidget",
8
+ __name: "pivot",
9
+ props: { fields: {} },
10
+ setup(__props) {
11
+ const { props, data, size, setFilter, ownFilters, editing, setProps, setWorkbook } = useDashboardWidget();
12
+ const pivot = shallowRef();
13
+ setWorkbook(() => pivot.value?.toSheet({ name: "" }));
14
+ const rows = computed(() => rowsOf(data.value, props.value.path));
15
+ const config = shallowRef(props.value.config);
16
+ watch(() => props.value.config, (next) => config.value = next);
17
+ function onConfig(next) {
18
+ config.value = next;
19
+ if (editing.value) setProps({ config: next }, { group: "pivot-config" });
20
+ }
21
+ const nameOf = (dimension) => typeof dimension === "string" ? dimension : dimension.field;
22
+ /** The groups this widget's filters picked, marked in the table. */
23
+ function pathOf(dimensions = [], filters) {
24
+ const path = [];
25
+ for (const dimension of dimensions) {
26
+ const value = filters[nameOf(dimension)];
27
+ if (value === void 0) break;
28
+ path.push(value);
29
+ }
30
+ return path;
31
+ }
32
+ const highlight = computed(() => {
33
+ if (!props.value.filter) return void 0;
34
+ const filters = ownFilters.value;
35
+ return {
36
+ row: pathOf(config.value?.rows, filters),
37
+ column: pathOf(config.value?.columns, filters)
38
+ };
39
+ });
40
+ /** One filter per field of a group's path; the fields past its end are cleared. */
41
+ function apply(dimensions = [], path, labels) {
42
+ dimensions.forEach((dimension, i) => i < path.length ? setFilter(nameOf(dimension), filterValueOf(path[i]), { label: labels[i] }) : setFilter(nameOf(dimension), void 0));
43
+ }
44
+ /** Sets one filter per field of the clicked cell's groups; a total clears the deeper ones. */
45
+ function onCell(cell) {
46
+ if (!props.value.filter) return;
47
+ const { rows: rowDims, columns: columnDims } = config.value ?? {};
48
+ apply(rowDims, cell.row, cell.labels.row);
49
+ apply(columnDims, cell.column, cell.labels.column);
50
+ }
51
+ return (_ctx, _cache) => {
52
+ return openBlock(), createBlock(unref(DouPivot), {
53
+ ref_key: "pivot",
54
+ ref: pivot,
55
+ class: "dou-dashboard-pivot",
56
+ data: rows.value,
57
+ fields: __props.fields,
58
+ config: config.value,
59
+ highlight: highlight.value,
60
+ size: "sm",
61
+ "max-height": unref(size).height.value || void 0,
62
+ "onUpdate:config": onConfig,
63
+ onCellClick: onCell
64
+ }, null, 8, [
65
+ "data",
66
+ "fields",
67
+ "config",
68
+ "highlight",
69
+ "max-height"
70
+ ]);
71
+ };
72
+ }
73
+ });
74
+ export { pivot_vue_vue_type_script_setup_true_lang_default as default };
75
+
76
+ //# sourceMappingURL=pivot.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pivot.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref"],"sources":["../../src/pivot/pivot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivot } from '@dou-ui/pivot'\nimport type {\n PivotCellEvent,\n PivotConfig,\n PivotDimension,\n PivotExpose,\n PivotField,\n} from '@dou-ui/pivot'\nimport { computed, shallowRef, watch } from 'vue'\nimport { useDashboardWidget } from '../widget/context'\nimport { filterValueOf, rowsOf } from '../widgets/shared'\nimport type { PivotWidgetProps } from './types'\n\ndefineOptions({ name: 'DouDashboardPivotWidget' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\n\nconst { props, data, size, setFilter, ownFilters, editing, setProps, setWorkbook } =\n useDashboardWidget<PivotWidgetProps>()\nconst pivot = shallowRef<PivotExpose>()\n// the export menu writes the table as it shows: merged heads, totals, number formats\nsetWorkbook(() => pivot.value?.toSheet({ name: '' }))\nconst rows = computed(() => rowsOf(data.value, props.value.path))\n// sorting in the table works while viewing too; only while editing is it saved\nconst config = shallowRef<PivotConfig | undefined>(props.value.config)\nwatch(\n () => props.value.config,\n (next) => (config.value = next),\n)\nfunction onConfig(next: PivotConfig) {\n config.value = next\n if (editing.value) setProps({ config: next }, { group: 'pivot-config' })\n}\nconst nameOf = (dimension: PivotDimension) =>\n typeof dimension === 'string' ? dimension : dimension.field\n\n/** The groups this widget's filters picked, marked in the table. */\nfunction pathOf(dimensions: readonly PivotDimension[] = [], filters: Record<string, unknown>) {\n const path: unknown[] = []\n for (const dimension of dimensions) {\n const value = filters[nameOf(dimension)]\n if (value === undefined) break\n path.push(value)\n }\n return path\n}\nconst highlight = computed(() => {\n if (!props.value.filter) return undefined\n const filters = ownFilters.value\n return {\n row: pathOf(config.value?.rows, filters),\n column: pathOf(config.value?.columns, filters),\n }\n})\n\n/** One filter per field of a group's path; the fields past its end are cleared. */\nfunction apply(\n dimensions: readonly PivotDimension[] = [],\n path: readonly unknown[],\n labels: string[],\n) {\n dimensions.forEach((dimension, i) =>\n i < path.length\n ? setFilter(nameOf(dimension), filterValueOf(path[i]), { label: labels[i] })\n : setFilter(nameOf(dimension), undefined),\n )\n}\n\n/** Sets one filter per field of the clicked cell's groups; a total clears the deeper ones. */\nfunction onCell(cell: PivotCellEvent) {\n if (!props.value.filter) return\n const { rows: rowDims, columns: columnDims } = config.value ?? {}\n apply(rowDims, cell.row, cell.labels.row)\n apply(columnDims, cell.column, cell.labels.column)\n}\n</script>\n\n<template>\n <DouPivot\n ref=\"pivot\"\n class=\"dou-dashboard-pivot\"\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"config\"\n :highlight=\"highlight\"\n size=\"sm\"\n :max-height=\"size.height.value || undefined\"\n @update:config=\"onConfig\"\n @cell-click=\"onCell\"\n />\n</template>\n"],"mappings":";;;;;;;;;;EAkBA,MAAM,EAAE,OAAO,MAAM,MAAM,WAAW,YAAY,SAAS,UAAU,gBACnE,mBAAqC;EACvC,MAAM,QAAQ,WAAwB;EAEtC,kBAAkB,MAAM,OAAO,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC;EACpD,MAAM,OAAO,eAAe,OAAO,KAAK,OAAO,MAAM,MAAM,IAAI,CAAC;EAEhE,MAAM,SAAS,WAAoC,MAAM,MAAM,MAAM;EACrE,YACQ,MAAM,MAAM,SACjB,SAAU,OAAO,QAAQ,IAC5B;EACA,SAAS,SAAS,MAAmB;GACnC,OAAO,QAAQ;GACf,IAAI,QAAQ,OAAO,SAAS,EAAE,QAAQ,KAAK,GAAG,EAAE,OAAO,eAAe,CAAC;EACzE;EACA,MAAM,UAAU,cACd,OAAO,cAAc,WAAW,YAAY,UAAU;;EAGxD,SAAS,OAAO,aAAwC,CAAC,GAAG,SAAkC;GAC5F,MAAM,OAAkB,CAAC;GACzB,KAAK,MAAM,aAAa,YAAY;IAClC,MAAM,QAAQ,QAAQ,OAAO,SAAS;IACtC,IAAI,UAAU,KAAA,GAAW;IACzB,KAAK,KAAK,KAAK;GACjB;GACA,OAAO;EACT;EACA,MAAM,YAAY,eAAe;GAC/B,IAAI,CAAC,MAAM,MAAM,QAAQ,OAAO,KAAA;GAChC,MAAM,UAAU,WAAW;GAC3B,OAAO;IACL,KAAK,OAAO,OAAO,OAAO,MAAM,OAAO;IACvC,QAAQ,OAAO,OAAO,OAAO,SAAS,OAAO;GAC/C;EACF,CAAC;;EAGD,SAAS,MACP,aAAwC,CAAC,GACzC,MACA,QACA;GACA,WAAW,SAAS,WAAW,MAC7B,IAAI,KAAK,SACL,UAAU,OAAO,SAAS,GAAG,cAAc,KAAK,EAAE,GAAG,EAAE,OAAO,OAAO,GAAG,CAAC,IACzE,UAAU,OAAO,SAAS,GAAG,KAAA,CAAS,CAC5C;EACF;;EAGA,SAAS,OAAO,MAAsB;GACpC,IAAI,CAAC,MAAM,MAAM,QAAQ;GACzB,MAAM,EAAE,MAAM,SAAS,SAAS,eAAe,OAAO,SAAS,CAAC;GAChE,MAAM,SAAS,KAAK,KAAK,KAAK,OAAO,GAAG;GACxC,MAAM,YAAY,KAAK,QAAQ,KAAK,OAAO,MAAM;EACnD;;GAIE,OAAAA,UAAA,GAAAC,YAWEC,MAAA,QAAA,GAAA;IAVI,SAAA;IAAJ,KAAI;IACJ,OAAM;IACL,MAAM,KAAA;IACN,QAAQ,QAAA;IACR,QAAQ,OAAA;IACR,WAAW,UAAA;IACZ,MAAK;IACJ,cAAYA,MAAA,IAAA,CAAI,CAAC,OAAO,SAAS,KAAA;IACjC,mBAAe;IACf,aAAY"}
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ @layer dou.components{.dou-grid-layout{--dou-grid-item-radius:var(--dou-radius-container);--dou-grid-col:calc((100cqw - (var(--dou-grid-columns) - 1)*var(--dou-grid-gap-x))/var(--dou-grid-columns));position:relative;box-sizing:border-box;height:calc(var(--dou-grid-rows)*var(--dou-grid-row) + max(var(--dou-grid-rows) - 1,0)*var(--dou-grid-gap-y));container-type:inline-size;width:100%;min-width:0}.dou-grid-layout.is-pointer-dragging{cursor:grabbing}.dou-grid-layout.is-resizing{cursor:nwse-resize}.dou-grid-layout__item,.dou-grid-layout__placeholder{position:absolute;box-sizing:border-box;width:calc(var(--dou-grid-w)*var(--dou-grid-col) + (var(--dou-grid-w) - 1)*var(--dou-grid-gap-x) + var(--dou-grid-dw,0px));height:calc(var(--dou-grid-h)*var(--dou-grid-row) + (var(--dou-grid-h) - 1)*var(--dou-grid-gap-y) + var(--dou-grid-dh,0px));border-radius:var(--dou-grid-item-radius);transform:translate(calc(var(--dou-grid-x)*(var(--dou-grid-col) + var(--dou-grid-gap-x)) + var(--dou-grid-dx,0px)),calc(var(--dou-grid-y)*(var(--dou-grid-row) + var(--dou-grid-gap-y)) + var(--dou-grid-dy,0px)));top:0;left:0}.dou-grid-layout__item{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);outline:none;min-width:0}.dou-grid-layout__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-grid-layout.is-editable .dou-grid-layout__item.is-movable{user-select:none;-webkit-touch-callout:none}.dou-grid-layout.is-editable:not(:-webkit-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:-moz-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:is(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-arranging .dou-grid-layout__item{transition:transform var(--dou-motion-duration-normal)var(--dou-motion-easing)}.dou-grid-layout__item.is-dragging,.dou-grid-layout__item.is-resizing{z-index:2;box-shadow:var(--dou-shadow-lg)}.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-dragging,.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-resizing{transition:none}.dou-grid-layout__placeholder{z-index:1;border:1px dashed var(--dou-color-border-strong);background-color:color-mix(in oklab,var(--dou-color-text)4%,transparent);pointer-events:none}.dou-grid-layout.is-arranging .dou-grid-layout__placeholder{transition:transform var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-grid-layout__resize{position:absolute;z-index:1;touch-action:none}.dou-grid-layout__resize.is-e{cursor:ew-resize;width:8px;top:8px;bottom:16px;right:-4px}.dou-grid-layout__resize.is-s{cursor:ns-resize;height:8px;bottom:-4px;left:8px;right:16px}.dou-grid-layout__resize.is-se{cursor:nwse-resize;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:20px;height:20px;bottom:0;right:0}.dou-grid-layout__resize.is-se:after{position:absolute;box-sizing:border-box;border-right:2px solid var(--dou-color-text-tertiary);border-bottom:2px solid var(--dou-color-text-tertiary);content:"";border-bottom-right-radius:4px;width:8px;height:8px;bottom:5px;right:5px}.dou-grid-layout__item:hover>.dou-grid-layout__resize.is-se,.dou-grid-layout__item.is-resizing>.dou-grid-layout__resize.is-se{opacity:1}.dou-grid-layout__item:focus-visible>.dou-grid-layout__resize.is-se{opacity:1}@media (pointer:coarse){.dou-grid-layout__resize.is-se{opacity:1;width:32px;height:32px}}.dou-grid-layout__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}}@layer dou.components{.dou-dashboard{position:relative;outline:none;min-width:0}.dou-dashboard__widget{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:inherit;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);overflow:hidden;flex-direction:column;min-width:0;min-height:0}.dou-grid-layout__item.is-dragging>.dou-dashboard__widget,.dou-grid-layout__item.is-resizing>.dou-dashboard__widget{border-color:var(--dou-color-border-strong)}.dou-dashboard__widget.has-peers{outline:1.5px solid var(--dou-dashboard-peer-color);outline-offset:2px}.dou-dashboard__peers{position:absolute;z-index:1;display:flex;overflow:hidden;pointer-events:none;gap:4px;max-width:calc(100% - 24px);margin-bottom:-10px;bottom:100%;left:12px}.dou-dashboard__peer{background-color:var(--dou-dashboard-peer-color);color:oklch(from var(--dou-dashboard-peer-color)clamp(.2,(.66 - l)*100,.99)0 0);font-size:var(--dou-font-size-sm);white-space:nowrap;border-radius:4px;flex:none;padding:0 6px;line-height:18px}.dou-dashboard__peer.is-focus{animation:dou-dashboard-peer-name var(--dou-motion-duration-fast)var(--dou-motion-easing)3s forwards}.dou-dashboard__header{display:flex;flex:none;align-items: center;gap:8px;height:40px;padding:0 8px 0 16px}.dou-dashboard__title{overflow:hidden;color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium);text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:min(6em,40%)}.dou-dashboard__title .dou-editable__view{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:inherit}.dou-dashboard__links{display:flex;overflow:hidden;flex:0 auto;gap:4px;min-width:0;max-width:60%}.dou-dashboard__links .dou-tag{min-width:0;max-width:100%}.dou-dashboard__links .dou-tag__label{overflow-x:clip;white-space:nowrap;text-overflow:ellipsis;min-width:0}.dou-dashboard__actions{display:flex;color:var(--dou-color-text-tertiary);flex:none;align-items: center;gap:2px}.dou-dashboard__trigger{display:inline-flex;flex:none}.dou-dashboard__export-error{flex:none;padding:0 8px 8px}.dou-dashboard__export-error .dou-alert__description{overflow-y:auto;max-height:4.5lh}.dou-dashboard__body{position:relative;flex:auto;min-width:0;min-height:0;padding:0 16px 16px}.dou-dashboard__body.is-fullscreen{height:100%;padding:0}.dou-dashboard__content{min-width:0;height:100%}.dou-dashboard__notice{display:grid;color:var(--dou-color-text-tertiary);text-align:center;place-items: center;height:100%}.dou-dashboard__status{position:absolute;display:flex;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);text-align:center;flex-direction:column;justify-content:center;align-items: center;gap:8px;padding:0 16px 16px;inset:0}.dou-dashboard__status.is-loading{background-color:color-mix(in oklab,var(--dou-color-bg-surface)72%,transparent);animation:dou-dashboard-fade-in var(--dou-motion-duration-fast)var(--dou-motion-easing).12s both}.dou-dashboard__status-icon{color:var(--dou-color-danger);width:20px;height:20px}.dou-dashboard__empty{position:absolute;display:grid;border:1px dashed var(--dou-color-border);border-radius:var(--dou-radius-container);pointer-events:none;place-items: center;inset:0}.dou-dashboard__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-dashboard__settings{display:flex;flex-direction:column;gap:16px}.dou-dashboard__field{display:flex;flex-direction:column;gap:8px}.dou-dashboard__field-hint{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-dashboard__field-row{display:flex;flex-wrap:wrap;gap:16px}.dou-dashboard__field-row>.dou-dashboard__field{flex:120px;min-width:0}.dou-dashboard__columns{display:flex;flex-direction:column;gap:8px}.dou-dashboard__column{display:grid;grid-template-columns:minmax(0,1fr)minmax(0,1fr);align-items: center;gap:8px}.dou-dashboard__field-label{color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium)}@keyframes dou-dashboard-fade-in{0%{opacity:0}}.dou-dashboard-palette{display:flex;list-style:none;flex-direction:column;gap:8px;margin:0;padding:0}.dou-dashboard-palette.is-horizontal{flex-flow:wrap}.dou-dashboard-palette>li{margin:0}.dou-dashboard-palette__item{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text);font:inherit;font-size:var(--dou-font-size-sm);cursor:grab;user-select:none;-webkit-touch-callout:none;transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);align-items: center;gap:8px;width:100%;height:32px;padding:0 12px}.dou-dashboard-palette__item:hover:not(:disabled){border-color:var(--dou-color-border-strong)}.dou-dashboard-palette__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-dashboard-palette__item:disabled{color:var(--dou-color-text-tertiary);cursor:not-allowed}.dou-dashboard-palette__icon{color:var(--dou-color-text-secondary);flex:none;width:16px;height:16px}.dou-dashboard-palette__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dou-dashboard-filter{display:flex;flex-wrap:wrap;align-items: center;gap:8px 16px}.dou-dashboard-filter__field{display:flex;align-items: center;gap:8px;min-width:0}.dou-dashboard-filter__label{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);white-space:nowrap;flex:none}.dou-dashboard-filter__control{width:144px;min-width:0}.dou-dashboard-filter__control.is-range{width:272px}.dou-dashboard-filter__extra{display:flex;align-items: center;gap:4px;margin-left:auto}@media (max-width:480px){.dou-dashboard-filter__field{flex:100%}.dou-dashboard-filter__label{width:4em}.dou-dashboard-filter__control,.dou-dashboard-filter__control.is-range{flex:auto;width:auto}}.dou-dashboard-stat{display:flex;container-type:inline-size;flex-direction:column;justify-content:space-between;gap:8px;height:100%}@container (width<=200px){.dou-dashboard-stat .dou-statistic{--dou-statistic-value-size:22px}}.dou-dashboard-stat__spark{flex:none;margin:0 -16px -16px}.dou-dashboard-text{overflow:auto;color:var(--dou-color-text);white-space:pre-wrap;overflow-wrap:anywhere;height:100%;line-height:1.6}.dou-dashboard-text.is-sm{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm)}.dou-dashboard-text.is-md{font-size:var(--dou-font-size-md)}.dou-dashboard-text.is-lg{font-size:var(--dou-font-size-lg);font-weight:var(--dou-font-weight-medium);line-height:1.4}.dou-dashboard.is-exporting .dou-dashboard__actions{display:none}.dou-dashboard.is-exporting .dou-dashboard__links .dou-tag__close{display:none}.dou-dashboard.is-exporting .dou-dashboard__export-error{display:none}.dou-dashboard.is-exporting .dou-dashboard__peers{display:none}.dou-dashboard.is-exporting .dou-grid-layout__resize{display:none}.dou-dashboard.is-exporting .dou-dashboard__live{display:none}.dou-dashboard.is-exporting .dou-grid-layout__item{outline:none}.dou-dashboard.is-exporting .dou-dashboard__widget{outline:none}@media print{.dou-dashboard{print-color-adjust:exact}.dou-dashboard__actions,.dou-dashboard__links .dou-tag__close,.dou-dashboard__export-error,.dou-dashboard__peers,.dou-grid-layout__resize,.dou-dashboard-filter__clear,.dou-dashboard-filter__extra{display:none}.dou-grid-layout__item{outline:none;break-inside:avoid}.dou-dashboard__widget{outline:none}}}@keyframes dou-dashboard-peer-name{to{opacity:0;visibility:hidden}}
@@ -0,0 +1 @@
1
+ export {}
package/dist/style.js ADDED
@@ -0,0 +1,12 @@
1
+ import 'dou-ui/components/alert/style'
2
+ import 'dou-ui/components/date-picker/style'
3
+ import 'dou-ui/components/dialog/style'
4
+ import 'dou-ui/components/drawer/style'
5
+ import 'dou-ui/components/editable/style'
6
+ import 'dou-ui/components/dropdown/style'
7
+ import 'dou-ui/components/empty/style'
8
+ import 'dou-ui/components/grid/style'
9
+ import 'dou-ui/components/select/style'
10
+ import 'dou-ui/components/tooltip/style'
11
+ import '@dou-ui/sheet/style'
12
+ import './style.css'
@@ -0,0 +1,11 @@
1
+ import type { ChartWidgetProps } from './types';
2
+ type __VLS_ModelProps = {
3
+ modelValue: ChartWidgetProps;
4
+ };
5
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
+ "update:modelValue": (value: ChartWidgetProps) => any;
7
+ }, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
8
+ "onUpdate:modelValue"?: ((value: ChartWidgetProps) => any) | undefined;
9
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ declare const _default: typeof __VLS_export;
11
+ export default _default;
@@ -0,0 +1,3 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import type { WidgetOverrides } from '../widgets';
2
+ import type { ChartWidgetProps } from './types';
3
+ export type { ChartWidgetProps } from './types';
4
+ /**
5
+ * A chart of a source's rows (line, area, bar or pie), drawn with
6
+ * `@dou-ui/chart`; clicking an x can filter the other widgets. Needs
7
+ * `@dou-ui/chart` and its styles.
8
+ */
9
+ export declare function chartWidget(overrides?: WidgetOverrides<ChartWidgetProps>): import("..").DashboardWidgetType<ChartWidgetProps>;
@@ -0,0 +1,23 @@
1
+ /** The `props` of a `chart` widget. */
2
+ export interface ChartWidgetProps {
3
+ source?: string;
4
+ /** Where the rows are, when the data isn't the list itself. */
5
+ path?: string;
6
+ /** `line` by default. */
7
+ kind?: 'line' | 'area' | 'bar' | 'pie';
8
+ /** The row's key along x: categories or dates; a pie's slice names. */
9
+ x?: string;
10
+ /** The keys drawn, one series each; a pie draws the first. */
11
+ y?: string[];
12
+ /** Names of the keys in the legend and the tooltip. */
13
+ labels?: Record<string, string>;
14
+ /** Stacks the series (areas and bars). */
15
+ stacked?: boolean;
16
+ /** Lays bars across. */
17
+ horizontal?: boolean;
18
+ /**
19
+ * Clicking an x (or a slice) sets the filter of this name to it for the
20
+ * other widgets; clicking it again clears it.
21
+ */
22
+ filter?: string;
23
+ }