@das-fed/ui 1.1.4 → 6.3.0-beta.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 (152) hide show
  1. package/global/icons/index.local.js +1 -1
  2. package/global/style/index.css +1 -1
  3. package/global/style/scrollbar.css +22 -22
  4. package/global/theme/index.js +12 -12
  5. package/global/theme/module/color.js +31 -31
  6. package/global/theme/module/fontSize.js +5 -5
  7. package/global/theme/module/scrollbar.js +6 -6
  8. package/package.json +13 -7
  9. package/packages/business-components/app-container/index.js +154 -147
  10. package/packages/business-components/change-enterprises/index.css +1 -0
  11. package/packages/business-components/change-enterprises/index.js +241 -0
  12. package/packages/business-components/change-pwd/index.css +1 -0
  13. package/packages/business-components/change-pwd/index.js +330 -0
  14. package/packages/business-components/currency-page/index.css +1 -0
  15. package/packages/business-components/currency-page/index.js +99 -0
  16. package/packages/business-components/device-panel/index.css +1 -0
  17. package/packages/business-components/device-panel/index.js +115939 -0
  18. package/packages/business-components/echarts/index.js +93 -122
  19. package/packages/business-components/export-button/index.js +73 -66
  20. package/packages/business-components/import-button/index.js +213 -170
  21. package/packages/business-components/index.js +8 -1
  22. package/packages/business-components/layout-breadcrumb/index.js +82 -66
  23. package/packages/business-components/model-table-dialog/index.js +299 -289
  24. package/packages/business-components/process-configuration/index.css +1 -0
  25. package/packages/business-components/process-configuration/index.js +612 -0
  26. package/packages/business-components/process-form/index.css +1 -0
  27. package/packages/business-components/process-form/index.js +524 -0
  28. package/packages/business-components/process-search-form/index.js +73 -315
  29. package/packages/business-components/process-table/index.css +1 -1
  30. package/packages/business-components/process-table/index.js +186 -152
  31. package/packages/business-components/urgent-panel/index.css +1 -0
  32. package/packages/business-components/urgent-panel/index.js +3914 -0
  33. package/packages/business-components/user-org-dialog/index.js +466 -375
  34. package/packages/business-components/video-dialog/index.css +1 -0
  35. package/packages/business-components/video-dialog/index.js +1041 -0
  36. package/packages/business.js +1 -2
  37. package/packages/components/alert/index.js +449 -633
  38. package/packages/components/audio-video/index.css +1 -1
  39. package/packages/components/audio-video/index.js +312 -126
  40. package/packages/components/autocomplete/index.css +1 -1
  41. package/packages/components/autocomplete/index.js +312 -2923
  42. package/packages/components/breadcrumb/index.js +97 -82
  43. package/packages/components/button/index.css +1 -1
  44. package/packages/components/button/index.js +646 -787
  45. package/packages/components/calendar/index.css +1 -1
  46. package/packages/components/calendar/index.js +655 -3879
  47. package/packages/components/cascader/index.js +209 -203
  48. package/packages/components/checkbox/index.css +1 -1
  49. package/packages/components/checkbox/index.js +710 -872
  50. package/packages/components/collapse-panel/index.css +1 -1
  51. package/packages/components/collapse-panel/index.js +419 -601
  52. package/packages/components/collapse-transition/index.js +23 -21
  53. package/packages/components/collaspe/index.css +1 -1
  54. package/packages/components/collaspe/index.js +413 -595
  55. package/packages/components/color-picker/index.css +1 -1
  56. package/packages/components/color-picker/index.js +176 -133
  57. package/packages/components/custom-search-item/index.js +43 -37
  58. package/packages/components/date-picker/index.js +1338 -1459
  59. package/packages/components/dialog/index.js +441 -241
  60. package/packages/components/dimple-layout/index.css +1 -1
  61. package/packages/components/dimple-layout/index.js +1298 -1794
  62. package/packages/components/drawer/index.js +116 -101
  63. package/packages/components/dropdown/index.js +129 -109
  64. package/packages/components/edit-table/index.css +1 -1
  65. package/packages/components/edit-table/index.js +868 -752
  66. package/packages/components/empty/index.js +83 -78
  67. package/packages/components/form/index.js +22 -15
  68. package/packages/components/form-item/index.css +1 -1
  69. package/packages/components/form-item/index.js +601 -440
  70. package/packages/components/icon/index.css +1 -1
  71. package/packages/components/icon/index.js +38 -22
  72. package/packages/components/image-preview/index.css +1 -0
  73. package/packages/components/image-preview/index.js +2714 -0
  74. package/packages/components/image-upload/index.js +601 -765
  75. package/packages/components/image-viewer/index.css +1 -1
  76. package/packages/components/image-viewer/index.js +909 -990
  77. package/packages/components/index.js +2 -2
  78. package/packages/components/input/index.css +1 -1
  79. package/packages/components/input/index.js +284 -256
  80. package/packages/components/input-dialog-select/index.css +1 -1
  81. package/packages/components/input-dialog-select/index.js +179 -156
  82. package/packages/components/input-number/index.css +1 -1
  83. package/packages/components/input-number/index.js +157 -170
  84. package/packages/components/live-player/index.css +1 -0
  85. package/packages/components/live-player/index.js +170 -0
  86. package/packages/components/loading/index.js +17 -26
  87. package/packages/components/map/index.css +1 -1
  88. package/packages/components/map/index.js +18913 -461
  89. package/packages/components/menu-aside/index.css +1 -1
  90. package/packages/components/menu-aside/index.js +648 -713
  91. package/packages/components/menu-header/index.js +446 -629
  92. package/packages/components/message/index.js +25 -16
  93. package/packages/components/notification/index.js +386 -575
  94. package/packages/components/overlay/index.js +112 -103
  95. package/packages/components/pagination/index.js +260 -330
  96. package/packages/components/popover/index.js +104 -93
  97. package/packages/components/popup-mask/index.css +1 -1
  98. package/packages/components/popup-mask/index.js +77 -72
  99. package/packages/components/preview/index.js +33 -28
  100. package/packages/components/progress/index.js +214 -221
  101. package/packages/components/radio/index.css +1 -1
  102. package/packages/components/radio/index.js +699 -862
  103. package/packages/components/radio-tabs/index.js +144 -107
  104. package/packages/components/rich-editor/index.css +1 -1
  105. package/packages/components/rich-editor/index.js +105 -106
  106. package/packages/components/scrollbar/index.css +3 -2
  107. package/packages/components/scrollbar/index.js +2262 -1201
  108. package/packages/components/search/index.js +500 -664
  109. package/packages/components/search-form/index.css +1 -1
  110. package/packages/components/search-form/index.js +724 -626
  111. package/packages/components/select/index.css +1 -1
  112. package/packages/components/select/index.js +1052 -950
  113. package/packages/components/select-input/index.js +63 -53
  114. package/packages/components/select-list/index.css +1 -1
  115. package/packages/components/select-list/index.js +258 -235
  116. package/packages/components/special-range-picker-month/index.css +1 -1
  117. package/packages/components/special-range-picker-month/index.js +3068 -72555
  118. package/packages/components/special-range-picker-year/index.css +1 -1
  119. package/packages/components/special-range-picker-year/index.js +345 -339
  120. package/packages/components/spin/index.js +415 -594
  121. package/packages/components/split-panel/index.css +1 -1
  122. package/packages/components/split-panel/index.js +146 -127
  123. package/packages/components/step/index.js +414 -597
  124. package/packages/components/steps/index.js +407 -590
  125. package/packages/components/switch/index.js +23 -23
  126. package/packages/components/table/index.css +1 -1
  127. package/packages/components/table/index.js +80813 -27734
  128. package/packages/components/tabs/index.css +1 -1
  129. package/packages/components/tabs/index.js +620 -813
  130. package/packages/components/tag/index.js +63 -63
  131. package/packages/components/text-tooltip/index.css +9 -0
  132. package/packages/components/text-tooltip/index.js +2739 -33
  133. package/packages/components/time-line/index.js +464 -643
  134. package/packages/components/tooltip/index.css +1 -1
  135. package/packages/components/tooltip/index.js +108 -79
  136. package/packages/components/tree/index.css +1 -1
  137. package/packages/components/tree/index.js +840 -809
  138. package/packages/components/tree-select/index.js +271 -303
  139. package/packages/components/tree-table/index.js +461 -352
  140. package/packages/components/upload/index.js +682 -858
  141. package/packages/components/virtual-tree/index.css +1 -1
  142. package/packages/components/virtual-tree/index.js +144 -126
  143. package/packages/index.d.ts +1 -0
  144. package/packages/index.js +2 -2
  145. package/style/business.css +11 -4
  146. package/style/index.css +55 -45
  147. package/packages/business-components/low-code/index.css +0 -1
  148. package/packages/business-components/low-code/index.js +0 -60
  149. package/packages/components/audio-video-player/index.css +0 -1
  150. package/packages/components/audio-video-player/index.js +0 -83
  151. package/packages/components/table-column/index.css +0 -1
  152. package/packages/components/table-column/index.js +0 -82021
@@ -0,0 +1,1041 @@
1
+ import { defineComponent, useCssVars, ref as ref$1, computed, nextTick as nextTick$1, openBlock, createElementBlock, normalizeClass, renderSlot, createCommentVNode, Fragment, renderList, createBlock, withCtx, withModifiers, createVNode, createElementVNode, watch as watch$1, toDisplayString, pushScopeId, popScopeId, toRefs, onMounted as onMounted$1 } from 'vue';
2
+ import { withInstall } from '@das-fed/utils';
3
+ import { DasTooltip, DasIcon, DasLivePlayer, DasSpin, DasDialog } from '@das-fed/ui';
4
+ import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, ref, watch } from 'vue-demi';
5
+ import { createService } from '@das-fed/utils/api-services/src/create-service';
6
+ import { getProjectInfo, getToken } from '@das-fed/utils/common-info';
7
+
8
+ var _a;
9
+ const isClient = typeof window !== "undefined";
10
+ const isString = (val) => typeof val === "string";
11
+ const noop = () => {
12
+ };
13
+ isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
14
+
15
+ function resolveUnref(r) {
16
+ return typeof r === "function" ? r() : unref(r);
17
+ }
18
+ function identity(arg) {
19
+ return arg;
20
+ }
21
+
22
+ function tryOnScopeDispose(fn) {
23
+ if (getCurrentScope()) {
24
+ onScopeDispose(fn);
25
+ return true;
26
+ }
27
+ return false;
28
+ }
29
+
30
+ function tryOnMounted(fn, sync = true) {
31
+ if (getCurrentInstance())
32
+ onMounted(fn);
33
+ else if (sync)
34
+ fn();
35
+ else
36
+ nextTick(fn);
37
+ }
38
+
39
+ function unrefElement(elRef) {
40
+ var _a;
41
+ const plain = resolveUnref(elRef);
42
+ return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
43
+ }
44
+
45
+ const defaultWindow = isClient ? window : void 0;
46
+ const defaultDocument = isClient ? window.document : void 0;
47
+
48
+ function useEventListener(...args) {
49
+ let target;
50
+ let events;
51
+ let listeners;
52
+ let options;
53
+ if (isString(args[0]) || Array.isArray(args[0])) {
54
+ [events, listeners, options] = args;
55
+ target = defaultWindow;
56
+ } else {
57
+ [target, events, listeners, options] = args;
58
+ }
59
+ if (!target)
60
+ return noop;
61
+ if (!Array.isArray(events))
62
+ events = [events];
63
+ if (!Array.isArray(listeners))
64
+ listeners = [listeners];
65
+ const cleanups = [];
66
+ const cleanup = () => {
67
+ cleanups.forEach((fn) => fn());
68
+ cleanups.length = 0;
69
+ };
70
+ const register = (el, event, listener, options2) => {
71
+ el.addEventListener(event, listener, options2);
72
+ return () => el.removeEventListener(event, listener, options2);
73
+ };
74
+ const stopWatch = watch(() => [unrefElement(target), resolveUnref(options)], ([el, options2]) => {
75
+ cleanup();
76
+ if (!el)
77
+ return;
78
+ cleanups.push(...events.flatMap((event) => {
79
+ return listeners.map((listener) => register(el, event, listener, options2));
80
+ }));
81
+ }, { immediate: true, flush: "post" });
82
+ const stop = () => {
83
+ stopWatch();
84
+ cleanup();
85
+ };
86
+ tryOnScopeDispose(stop);
87
+ return stop;
88
+ }
89
+
90
+ function useSupported(callback, sync = false) {
91
+ const isSupported = ref();
92
+ const update = () => isSupported.value = Boolean(callback());
93
+ update();
94
+ tryOnMounted(update, sync);
95
+ return isSupported;
96
+ }
97
+
98
+ const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
99
+ const globalKey = "__vueuse_ssr_handlers__";
100
+ _global[globalKey] = _global[globalKey] || {};
101
+
102
+ const functionsMap = [
103
+ [
104
+ "requestFullscreen",
105
+ "exitFullscreen",
106
+ "fullscreenElement",
107
+ "fullscreenEnabled",
108
+ "fullscreenchange",
109
+ "fullscreenerror"
110
+ ],
111
+ [
112
+ "webkitRequestFullscreen",
113
+ "webkitExitFullscreen",
114
+ "webkitFullscreenElement",
115
+ "webkitFullscreenEnabled",
116
+ "webkitfullscreenchange",
117
+ "webkitfullscreenerror"
118
+ ],
119
+ [
120
+ "webkitRequestFullScreen",
121
+ "webkitCancelFullScreen",
122
+ "webkitCurrentFullScreenElement",
123
+ "webkitCancelFullScreen",
124
+ "webkitfullscreenchange",
125
+ "webkitfullscreenerror"
126
+ ],
127
+ [
128
+ "mozRequestFullScreen",
129
+ "mozCancelFullScreen",
130
+ "mozFullScreenElement",
131
+ "mozFullScreenEnabled",
132
+ "mozfullscreenchange",
133
+ "mozfullscreenerror"
134
+ ],
135
+ [
136
+ "msRequestFullscreen",
137
+ "msExitFullscreen",
138
+ "msFullscreenElement",
139
+ "msFullscreenEnabled",
140
+ "MSFullscreenChange",
141
+ "MSFullscreenError"
142
+ ]
143
+ ];
144
+ function useFullscreen(target, options = {}) {
145
+ const { document = defaultDocument, autoExit = false } = options;
146
+ const targetRef = target || (document == null ? void 0 : document.querySelector("html"));
147
+ const isFullscreen = ref(false);
148
+ let map = functionsMap[0];
149
+ const isSupported = useSupported(() => {
150
+ if (!document) {
151
+ return false;
152
+ } else {
153
+ for (const m of functionsMap) {
154
+ if (m[1] in document) {
155
+ map = m;
156
+ return true;
157
+ }
158
+ }
159
+ }
160
+ return false;
161
+ });
162
+ const [REQUEST, EXIT, ELEMENT, , EVENT] = map;
163
+ async function exit() {
164
+ if (!isSupported.value)
165
+ return;
166
+ if (document == null ? void 0 : document[ELEMENT])
167
+ await document[EXIT]();
168
+ isFullscreen.value = false;
169
+ }
170
+ async function enter() {
171
+ if (!isSupported.value)
172
+ return;
173
+ await exit();
174
+ const target2 = unrefElement(targetRef);
175
+ if (target2) {
176
+ await target2[REQUEST]();
177
+ isFullscreen.value = true;
178
+ }
179
+ }
180
+ async function toggle() {
181
+ if (isFullscreen.value)
182
+ await exit();
183
+ else
184
+ await enter();
185
+ }
186
+ if (document) {
187
+ useEventListener(document, EVENT, () => {
188
+ isFullscreen.value = !!(document == null ? void 0 : document[ELEMENT]);
189
+ }, false);
190
+ }
191
+ if (autoExit)
192
+ tryOnScopeDispose(exit);
193
+ return {
194
+ isSupported,
195
+ isFullscreen,
196
+ enter,
197
+ exit,
198
+ toggle
199
+ };
200
+ }
201
+
202
+ var SwipeDirection;
203
+ (function(SwipeDirection2) {
204
+ SwipeDirection2["UP"] = "UP";
205
+ SwipeDirection2["RIGHT"] = "RIGHT";
206
+ SwipeDirection2["DOWN"] = "DOWN";
207
+ SwipeDirection2["LEFT"] = "LEFT";
208
+ SwipeDirection2["NONE"] = "NONE";
209
+ })(SwipeDirection || (SwipeDirection = {}));
210
+
211
+ var __defProp = Object.defineProperty;
212
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
213
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
214
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
215
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
216
+ var __spreadValues = (a, b) => {
217
+ for (var prop in b || (b = {}))
218
+ if (__hasOwnProp.call(b, prop))
219
+ __defNormalProp(a, prop, b[prop]);
220
+ if (__getOwnPropSymbols)
221
+ for (var prop of __getOwnPropSymbols(b)) {
222
+ if (__propIsEnum.call(b, prop))
223
+ __defNormalProp(a, prop, b[prop]);
224
+ }
225
+ return a;
226
+ };
227
+ const _TransitionPresets = {
228
+ easeInSine: [0.12, 0, 0.39, 0],
229
+ easeOutSine: [0.61, 1, 0.88, 1],
230
+ easeInOutSine: [0.37, 0, 0.63, 1],
231
+ easeInQuad: [0.11, 0, 0.5, 0],
232
+ easeOutQuad: [0.5, 1, 0.89, 1],
233
+ easeInOutQuad: [0.45, 0, 0.55, 1],
234
+ easeInCubic: [0.32, 0, 0.67, 0],
235
+ easeOutCubic: [0.33, 1, 0.68, 1],
236
+ easeInOutCubic: [0.65, 0, 0.35, 1],
237
+ easeInQuart: [0.5, 0, 0.75, 0],
238
+ easeOutQuart: [0.25, 1, 0.5, 1],
239
+ easeInOutQuart: [0.76, 0, 0.24, 1],
240
+ easeInQuint: [0.64, 0, 0.78, 0],
241
+ easeOutQuint: [0.22, 1, 0.36, 1],
242
+ easeInOutQuint: [0.83, 0, 0.17, 1],
243
+ easeInExpo: [0.7, 0, 0.84, 0],
244
+ easeOutExpo: [0.16, 1, 0.3, 1],
245
+ easeInOutExpo: [0.87, 0, 0.13, 1],
246
+ easeInCirc: [0.55, 0, 1, 0.45],
247
+ easeOutCirc: [0, 0.55, 0.45, 1],
248
+ easeInOutCirc: [0.85, 0, 0.15, 1],
249
+ easeInBack: [0.36, 0, 0.66, -0.56],
250
+ easeOutBack: [0.34, 1.56, 0.64, 1],
251
+ easeInOutBack: [0.68, -0.6, 0.32, 1.6]
252
+ };
253
+ __spreadValues({
254
+ linear: identity
255
+ }, _TransitionPresets);
256
+
257
+ var _sfc_main$4 = /* @__PURE__ */ defineComponent({
258
+ __name: "GridItem",
259
+ props: {
260
+ active: { type: Boolean, required: true },
261
+ gridNum: { type: Number, required: true }
262
+ },
263
+ emits: ["itemClick"],
264
+ setup(__props, { expose: __expose, emit: __emit }) {
265
+ __expose();
266
+ useCssVars((_ctx) => ({
267
+ "083b179d-size": size.value
268
+ }));
269
+ const props = __props;
270
+ const emits = __emit;
271
+ const containerRef = ref$1();
272
+ const { toggle, isFullscreen } = useFullscreen(containerRef);
273
+ const handleDBclick = () => {
274
+ if (containerRef.value != document.fullscreenElement) {
275
+ if (isFullscreen.value) {
276
+ isFullscreen.value = false;
277
+ nextTick$1(() => {
278
+ toggle();
279
+ });
280
+ } else {
281
+ toggle();
282
+ }
283
+ }
284
+ };
285
+ const handleItemClick = () => {
286
+ emits("itemClick");
287
+ };
288
+ const size = computed(() => `calc(100% / ${Math.sqrt(props.gridNum)})`);
289
+ const __returned__ = { props, emits, containerRef, toggle, isFullscreen, handleDBclick, handleItemClick, size };
290
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
291
+ return __returned__;
292
+ }
293
+ });
294
+
295
+ var _export_sfc = (sfc, props) => {
296
+ const target = sfc.__vccOpts || sfc;
297
+ for (const [key, val] of props) {
298
+ target[key] = val;
299
+ }
300
+ return target;
301
+ };
302
+
303
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
304
+ return openBlock(), createElementBlock(
305
+ "div",
306
+ {
307
+ ref: "containerRef",
308
+ class: normalizeClass(["wrapper", { "is-active": $setup.props.active }]),
309
+ onDblclick: _cache[0] || (_cache[0] = ($event) => $setup.handleDBclick()),
310
+ onClick: _cache[1] || (_cache[1] = ($event) => $setup.handleItemClick())
311
+ },
312
+ [
313
+ renderSlot(_ctx.$slots, "default", {}, void 0, true)
314
+ ],
315
+ 34
316
+ /* CLASS, NEED_HYDRATION */
317
+ );
318
+ }
319
+ var GridItem = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4], ["__scopeId", "data-v-083b179d"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/video-dialog/src/component/GridLayout/GridItem.vue"]]);
320
+
321
+ var _sfc_main$3 = /* @__PURE__ */ defineComponent({
322
+ __name: "GridLayout",
323
+ props: {
324
+ gridNum: { type: Number, required: true },
325
+ activeIndex: { type: Number, required: true, default: 0 },
326
+ showFn: { type: Function, required: true }
327
+ },
328
+ emits: ["update:activeIndex"],
329
+ setup(__props, { expose: __expose, emit: __emit }) {
330
+ __expose();
331
+ const props = __props;
332
+ const emits = __emit;
333
+ const handleItemClick = (index) => {
334
+ emits("update:activeIndex", index);
335
+ };
336
+ const __returned__ = { props, emits, handleItemClick, GridItem };
337
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
338
+ return __returned__;
339
+ }
340
+ });
341
+
342
+ const _hoisted_1$2 = { class: "layout-wrapper" };
343
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
344
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
345
+ createCommentVNode(' :active="index === activeIndex" '),
346
+ (openBlock(true), createElementBlock(
347
+ Fragment,
348
+ null,
349
+ renderList($setup.props.gridNum, (item, index) => {
350
+ return openBlock(), createBlock($setup["GridItem"], {
351
+ active: false,
352
+ "grid-num": $setup.props.gridNum,
353
+ onItemClick: ($event) => $setup.handleItemClick(index)
354
+ }, {
355
+ default: withCtx(() => [
356
+ $props.showFn(index) ? renderSlot(_ctx.$slots, "default", {
357
+ key: 0,
358
+ index
359
+ }, void 0, true) : createCommentVNode("v-if", true)
360
+ ]),
361
+ _: 2
362
+ /* DYNAMIC */
363
+ }, 1032, ["grid-num", "onItemClick"]);
364
+ }),
365
+ 256
366
+ /* UNKEYED_FRAGMENT */
367
+ ))
368
+ ]);
369
+ }
370
+ var GridLayout = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-52a0876d"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/video-dialog/src/component/GridLayout/GridLayout.vue"]]);
371
+
372
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
373
+
374
+ function getDefaultExportFromCjs (x) {
375
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
376
+ }
377
+
378
+ var dayjs_min = {exports: {}};
379
+
380
+ (function (module, exports) {
381
+ !function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
382
+ } (dayjs_min));
383
+
384
+ var dayjs_minExports = dayjs_min.exports;
385
+ var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
386
+
387
+ var _sfc_main$2 = /* @__PURE__ */ defineComponent({
388
+ __name: "DirectionControl",
389
+ emits: ["change"],
390
+ setup(__props, { expose: __expose, emit: __emit }) {
391
+ __expose();
392
+ const emits = __emit;
393
+ const directionControl = (direction) => {
394
+ emits("change", direction);
395
+ };
396
+ const __returned__ = { emits, directionControl, get DasTooltip() {
397
+ return DasTooltip;
398
+ } };
399
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
400
+ return __returned__;
401
+ }
402
+ });
403
+
404
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
405
+ return openBlock(), createElementBlock(
406
+ "div",
407
+ {
408
+ class: "direction-control",
409
+ onDblclick: _cache[9] || (_cache[9] = withModifiers((event) => event.stopPropagation(), ["stop"]))
410
+ },
411
+ [
412
+ createVNode($setup["DasTooltip"], { content: "\u5DE6\u4E0A" }, {
413
+ default: withCtx(() => [
414
+ createElementVNode("div", {
415
+ class: "icon icon-top-left",
416
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => $setup.directionControl("leftUp"), ["stop"]))
417
+ })
418
+ ]),
419
+ _: 1
420
+ /* STABLE */
421
+ }),
422
+ createVNode($setup["DasTooltip"], { content: "\u4E0A" }, {
423
+ default: withCtx(() => [
424
+ createElementVNode("div", {
425
+ class: "icon icon-top",
426
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => $setup.directionControl("up"), ["stop"]))
427
+ })
428
+ ]),
429
+ _: 1
430
+ /* STABLE */
431
+ }),
432
+ createVNode($setup["DasTooltip"], { content: "\u53F3\u4E0A" }, {
433
+ default: withCtx(() => [
434
+ createElementVNode("div", {
435
+ class: "icon icon-top-right",
436
+ onClick: _cache[2] || (_cache[2] = withModifiers(($event) => $setup.directionControl("rightUp"), ["stop"]))
437
+ })
438
+ ]),
439
+ _: 1
440
+ /* STABLE */
441
+ }),
442
+ createVNode($setup["DasTooltip"], { content: "\u5DE6" }, {
443
+ default: withCtx(() => [
444
+ createElementVNode("div", {
445
+ class: "icon icon-left",
446
+ onClick: _cache[3] || (_cache[3] = withModifiers(($event) => $setup.directionControl("left"), ["stop"]))
447
+ })
448
+ ]),
449
+ _: 1
450
+ /* STABLE */
451
+ }),
452
+ createVNode($setup["DasTooltip"], { content: "\u81EA\u52A8" }, {
453
+ default: withCtx(() => [
454
+ createElementVNode("div", {
455
+ class: "icon icon-auto",
456
+ onClick: _cache[4] || (_cache[4] = withModifiers(($event) => $setup.directionControl("auto"), ["stop"]))
457
+ })
458
+ ]),
459
+ _: 1
460
+ /* STABLE */
461
+ }),
462
+ createVNode($setup["DasTooltip"], { content: "\u53F3" }, {
463
+ default: withCtx(() => [
464
+ createElementVNode("div", {
465
+ class: "icon icon-right",
466
+ onClick: _cache[5] || (_cache[5] = withModifiers(($event) => $setup.directionControl("right"), ["stop"]))
467
+ })
468
+ ]),
469
+ _: 1
470
+ /* STABLE */
471
+ }),
472
+ createVNode($setup["DasTooltip"], { content: "\u5DE6\u4E0B" }, {
473
+ default: withCtx(() => [
474
+ createElementVNode("div", {
475
+ class: "icon icon-bottom-left",
476
+ onClick: _cache[6] || (_cache[6] = withModifiers(($event) => $setup.directionControl("leftDown"), ["stop"]))
477
+ })
478
+ ]),
479
+ _: 1
480
+ /* STABLE */
481
+ }),
482
+ createVNode($setup["DasTooltip"], { content: "\u4E0B" }, {
483
+ default: withCtx(() => [
484
+ createElementVNode("div", {
485
+ class: "icon icon-bottom",
486
+ onClick: _cache[7] || (_cache[7] = withModifiers(($event) => $setup.directionControl("down"), ["stop"]))
487
+ })
488
+ ]),
489
+ _: 1
490
+ /* STABLE */
491
+ }),
492
+ createVNode($setup["DasTooltip"], { content: "\u53F3\u4E0B" }, {
493
+ default: withCtx(() => [
494
+ createElementVNode("div", {
495
+ class: "icon icon-bottom-right",
496
+ onClick: _cache[8] || (_cache[8] = withModifiers(($event) => $setup.directionControl("rightDown"), ["stop"]))
497
+ })
498
+ ]),
499
+ _: 1
500
+ /* STABLE */
501
+ })
502
+ ],
503
+ 32
504
+ /* NEED_HYDRATION */
505
+ );
506
+ }
507
+ var DirectionControl = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-4e297881"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/video-dialog/src/component/Player/DirectionControl.vue"]]);
508
+
509
+ var _sfc_main$1 = /* @__PURE__ */ defineComponent({
510
+ __name: "index",
511
+ props: {
512
+ videoUrl: { type: String, required: false },
513
+ title: { type: String, required: true },
514
+ type: { type: String, required: true },
515
+ loading: { type: Boolean, required: true },
516
+ playbackRate: { type: Number, required: false, default: 1 },
517
+ paused: { type: Boolean, required: false, default: false },
518
+ authType: { type: Array, required: false, default: () => [] },
519
+ onReplay: { type: Function, required: false }
520
+ },
521
+ emits: ["close", "directionControl", "zoomControl"],
522
+ setup(__props, { expose: __expose, emit: __emit }) {
523
+ __expose();
524
+ const props = __props;
525
+ const emits = __emit;
526
+ const muted = ref$1(true);
527
+ const player = ref$1();
528
+ const directionControlVisible = ref$1(false);
529
+ const dasLivePlayerRef = ref$1();
530
+ const video = computed(() => dasLivePlayerRef.value?.video);
531
+ const ended = ref$1(false);
532
+ const showPlayer = ref$1(true);
533
+ const handleClose = () => {
534
+ emits("close");
535
+ };
536
+ const handlePlayerLoaded = (_player) => {
537
+ player.value = _player;
538
+ player.value.on(window.mpegts.Events.ERROR, (data) => {
539
+ console.log("player error", data);
540
+ });
541
+ };
542
+ const toggleMuted = () => {
543
+ muted.value = !muted.value;
544
+ if (player.value) {
545
+ player.value.muted = muted.value;
546
+ }
547
+ };
548
+ const toggleDirectionControl = () => {
549
+ directionControlVisible.value = !directionControlVisible.value;
550
+ };
551
+ const imgSrc = ref$1("");
552
+ const handleScreenshot = () => {
553
+ const canvas = document.createElement("canvas");
554
+ if (video.value) {
555
+ canvas.width = video.value.clientWidth;
556
+ canvas.height = video.value.clientHeight;
557
+ const context = canvas.getContext("2d");
558
+ context?.drawImage(video.value, 0, 0, canvas.width, canvas.height);
559
+ const oGrayImg = canvas.toDataURL("image/jpg");
560
+ const str = `\u3010${props.title}\u3011${dayjs().format("YYYYMMDDHHmmss").toString()}.jpg`;
561
+ imgSrc.value = oGrayImg;
562
+ if ("download" in document.createElement("a")) {
563
+ const elem = document.createElement("a");
564
+ elem.download = str;
565
+ elem.style.display = "none";
566
+ elem.href = oGrayImg;
567
+ document.body.appendChild(elem);
568
+ document.body.appendChild(canvas);
569
+ elem.click();
570
+ URL.revokeObjectURL(elem.href);
571
+ document.body.removeChild(elem);
572
+ document.body.removeChild(canvas);
573
+ }
574
+ }
575
+ };
576
+ const directionControl = (direction) => {
577
+ emits("directionControl", direction);
578
+ };
579
+ const zoomControl = (zoom) => {
580
+ emits("zoomControl", zoom);
581
+ };
582
+ const hasAuth = (type) => {
583
+ return props.authType.includes(type);
584
+ };
585
+ watch$1(
586
+ () => video.value,
587
+ () => {
588
+ if (video.value) {
589
+ video.value.addEventListener("ended", () => {
590
+ ended.value = true;
591
+ if (props.type === "playback") {
592
+ showPlayer.value = false;
593
+ }
594
+ });
595
+ }
596
+ }
597
+ );
598
+ watch$1(
599
+ () => video.value,
600
+ () => {
601
+ if (video.value) {
602
+ nextTick$1(() => {
603
+ video.value.playbackRate = props.playbackRate || 1;
604
+ });
605
+ }
606
+ }
607
+ );
608
+ watch$1(
609
+ () => player.value,
610
+ () => {
611
+ if (player.value) {
612
+ nextTick$1(() => {
613
+ player.value.muted = muted.value;
614
+ });
615
+ }
616
+ }
617
+ );
618
+ watch$1(
619
+ () => props.playbackRate,
620
+ () => {
621
+ if (video.value) {
622
+ video.value.playbackRate = props.playbackRate || 1;
623
+ }
624
+ },
625
+ {
626
+ immediate: true
627
+ }
628
+ );
629
+ watch$1(
630
+ () => props.paused,
631
+ () => {
632
+ if (player.value) {
633
+ if (props.paused) {
634
+ player.value.pause();
635
+ } else {
636
+ player.value.play();
637
+ }
638
+ }
639
+ }
640
+ );
641
+ watch$1(
642
+ () => props.videoUrl,
643
+ () => {
644
+ showPlayer.value = false;
645
+ nextTick$1(() => {
646
+ showPlayer.value = true;
647
+ });
648
+ }
649
+ );
650
+ const __returned__ = { props, emits, muted, player, directionControlVisible, dasLivePlayerRef, video, ended, showPlayer, handleClose, handlePlayerLoaded, toggleMuted, toggleDirectionControl, imgSrc, handleScreenshot, directionControl, zoomControl, hasAuth, get DasIcon() {
651
+ return DasIcon;
652
+ }, get DasLivePlayer() {
653
+ return DasLivePlayer;
654
+ }, get DasSpin() {
655
+ return DasSpin;
656
+ }, get DasTooltip() {
657
+ return DasTooltip;
658
+ }, DirectionControl };
659
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
660
+ return __returned__;
661
+ }
662
+ });
663
+
664
+ const _withScopeId = (n) => (pushScopeId("data-v-d319f5c0"), n = n(), popScopeId(), n);
665
+ const _hoisted_1$1 = { class: "video-wrapper" };
666
+ const _hoisted_2 = { class: "video-top" };
667
+ const _hoisted_3 = { class: "video-top_l" };
668
+ const _hoisted_4 = { class: "video-title-wrapper" };
669
+ const _hoisted_5 = { class: "video-title" };
670
+ const _hoisted_6 = { class: "video-top_r" };
671
+ const _hoisted_7 = {
672
+ key: 0,
673
+ class: "play-status"
674
+ };
675
+ const _hoisted_8 = { class: "video-bottom" };
676
+ const _hoisted_9 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode(
677
+ "div",
678
+ { class: "video-bottom_l" },
679
+ null,
680
+ -1
681
+ /* HOISTED */
682
+ ));
683
+ const _hoisted_10 = { class: "video-bottom_r" };
684
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
685
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
686
+ createVNode($setup["DasSpin"], {
687
+ spinning: $setup.props.loading,
688
+ type: "component",
689
+ tip: "\u52A0\u8F7D\u4E2D..."
690
+ }, {
691
+ default: withCtx(() => [
692
+ createElementVNode("div", _hoisted_2, [
693
+ createElementVNode("div", _hoisted_3, [
694
+ createElementVNode("div", _hoisted_4, [
695
+ createElementVNode(
696
+ "div",
697
+ _hoisted_5,
698
+ toDisplayString($setup.props.title.length > 20 ? $setup.props.title.slice(0, 19) + "..." : $setup.props.title),
699
+ 1
700
+ /* TEXT */
701
+ )
702
+ ])
703
+ ]),
704
+ createElementVNode("div", _hoisted_6, [
705
+ ["live"].includes($props.type) ? (openBlock(), createElementBlock("span", _hoisted_7, "\u6B63\u5728\u5B9E\u65F6\u9884\u89C8")) : createCommentVNode("v-if", true),
706
+ createCommentVNode(' <das-icon class="icon close-icon" icon="close" @click.stop="handleClose"></das-icon> ')
707
+ ])
708
+ ]),
709
+ $setup.props.videoUrl && $setup.showPlayer ? (openBlock(), createBlock($setup["DasLivePlayer"], {
710
+ key: 0,
711
+ type: "flv",
712
+ ref: "dasLivePlayerRef",
713
+ muted: $setup.muted,
714
+ onLoaded: $setup.handlePlayerLoaded,
715
+ src: $setup.props.videoUrl
716
+ }, null, 8, ["muted", "src"])) : createCommentVNode("v-if", true),
717
+ createElementVNode("div", _hoisted_8, [
718
+ _hoisted_9,
719
+ createElementVNode("div", _hoisted_10, [
720
+ createElementVNode(
721
+ "div",
722
+ {
723
+ class: "controls",
724
+ onDblclick: _cache[2] || (_cache[2] = withModifiers((event) => event.stopPropagation(), ["stop"]))
725
+ },
726
+ [
727
+ createVNode($setup["DasTooltip"], { content: "\u58F0\u97F3" }, {
728
+ default: withCtx(() => [
729
+ createVNode($setup["DasIcon"], {
730
+ class: "icon icon-volume",
731
+ icon: $setup.muted ? "muted" : "volume",
732
+ onClick: withModifiers($setup.toggleMuted, ["stop"])
733
+ }, null, 8, ["icon"])
734
+ ]),
735
+ _: 1
736
+ /* STABLE */
737
+ }),
738
+ createVNode($setup["DasTooltip"], { content: "\u622A\u56FE" }, {
739
+ default: withCtx(() => [
740
+ createVNode($setup["DasIcon"], {
741
+ class: "icon icon-screenshot",
742
+ icon: "screenshot",
743
+ onClick: withModifiers($setup.handleScreenshot, ["stop"])
744
+ })
745
+ ]),
746
+ _: 1
747
+ /* STABLE */
748
+ }),
749
+ $setup.hasAuth("control") ? (openBlock(), createBlock($setup["DasTooltip"], {
750
+ key: 0,
751
+ content: "\u805A\u7126-"
752
+ }, {
753
+ default: withCtx(() => [
754
+ ["live", "polling"].includes($setup.props.type) ? (openBlock(), createBlock($setup["DasIcon"], {
755
+ key: 0,
756
+ class: "icon icon-shrink",
757
+ icon: "shrink",
758
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => $setup.zoomControl("zoomOut"), ["stop"]))
759
+ })) : createCommentVNode("v-if", true)
760
+ ]),
761
+ _: 1
762
+ /* STABLE */
763
+ })) : createCommentVNode("v-if", true),
764
+ $setup.hasAuth("control") ? (openBlock(), createBlock($setup["DasTooltip"], {
765
+ key: 1,
766
+ content: "\u805A\u7126+"
767
+ }, {
768
+ default: withCtx(() => [
769
+ ["live", "polling"].includes($setup.props.type) ? (openBlock(), createBlock($setup["DasIcon"], {
770
+ key: 0,
771
+ class: "icon icon-enlarge",
772
+ icon: "enlarge",
773
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => $setup.zoomControl("zoomIn"), ["stop"]))
774
+ })) : createCommentVNode("v-if", true)
775
+ ]),
776
+ _: 1
777
+ /* STABLE */
778
+ })) : createCommentVNode("v-if", true),
779
+ $setup.hasAuth("control") ? (openBlock(), createBlock($setup["DasTooltip"], {
780
+ key: 2,
781
+ content: "\u65B9\u5411\u63A7\u5236"
782
+ }, {
783
+ default: withCtx(() => [
784
+ ["live", "polling"].includes($setup.props.type) ? (openBlock(), createBlock($setup["DasIcon"], {
785
+ key: 0,
786
+ class: "icon icon-direction-control",
787
+ icon: "direction-control",
788
+ onClick: withModifiers($setup.toggleDirectionControl, ["stop"])
789
+ })) : createCommentVNode("v-if", true)
790
+ ]),
791
+ _: 1
792
+ /* STABLE */
793
+ })) : createCommentVNode("v-if", true)
794
+ ],
795
+ 32
796
+ /* NEED_HYDRATION */
797
+ )
798
+ ])
799
+ ]),
800
+ $setup.directionControlVisible ? (openBlock(), createBlock($setup["DirectionControl"], {
801
+ key: 1,
802
+ onChange: $setup.directionControl
803
+ })) : createCommentVNode("v-if", true)
804
+ ]),
805
+ _: 1
806
+ /* STABLE */
807
+ }, 8, ["spinning"])
808
+ ]);
809
+ }
810
+ var Player = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-d319f5c0"], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/video-dialog/src/component/Player/index.vue"]]);
811
+
812
+ const bemsBase = `/api/intelligent-security/video/v1`;
813
+ const version = "v1";
814
+ const permissiontService = createService(`/api/enterpriseright/permission/${version}`);
815
+ const service = createService(`${bemsBase}`, mergeCommonParams);
816
+ function mergeCommonParams(config) {
817
+ const projectId = getProjectInfo() ? getProjectInfo().id : 1;
818
+ if (!config.params) config.params = {};
819
+ config.params.project = projectId;
820
+ config.params.projectId = projectId;
821
+ return config;
822
+ }
823
+ function paramsToQuery(params) {
824
+ const searchParams = new URLSearchParams("");
825
+ for (let [key, val] of Object.entries(params)) {
826
+ searchParams.append(key, val);
827
+ }
828
+ return searchParams.toString();
829
+ }
830
+ function operateDevice(params) {
831
+ return service.post(`/device/ptz?${paramsToQuery(params)}`)().run();
832
+ }
833
+ function getRealTimeUrl(params) {
834
+ return service.post(`/device/video/url/preview?${paramsToQuery(params)}`)().run();
835
+ }
836
+ permissiontService.post("data/device-auth");
837
+
838
+ const withToken = (url) => {
839
+ const token = getToken();
840
+ return `${url}?token=${token}`;
841
+ };
842
+ ref$1([]);
843
+
844
+ var PlayerProvider = /* @__PURE__ */ defineComponent({
845
+ props: {
846
+ deviceInfo: {
847
+ type: Object,
848
+ required: true
849
+ }
850
+ },
851
+ setup(props, {
852
+ slots
853
+ }) {
854
+ const {
855
+ deviceInfo
856
+ } = toRefs(props);
857
+ const loading = ref$1(false);
858
+ const videoUrl = ref$1("");
859
+ const fetchData = async () => {
860
+ if (!deviceInfo.value?.deviceId) return;
861
+ loading.value = true;
862
+ const [error, data] = await getRealTimeUrl({
863
+ productId: deviceInfo.value.productId,
864
+ deviceId: deviceInfo.value.deviceId
865
+ });
866
+ if (!error) {
867
+ videoUrl.value = withToken(data.playStreamURL);
868
+ }
869
+ loading.value = false;
870
+ };
871
+ const onDirectionControl = (direction) => {
872
+ operateDevice({
873
+ productId: deviceInfo.value.productId,
874
+ deviceId: deviceInfo.value.deviceId,
875
+ direction,
876
+ zoom: ""
877
+ });
878
+ };
879
+ const onZoomControl = (zoom) => {
880
+ operateDevice({
881
+ productId: deviceInfo.value.productId,
882
+ deviceId: deviceInfo.value.deviceId,
883
+ direction: "",
884
+ zoom
885
+ });
886
+ };
887
+ onMounted$1(() => {
888
+ fetchData();
889
+ });
890
+ watch$1(() => deviceInfo.value, () => {
891
+ fetchData();
892
+ }, {
893
+ deep: true
894
+ });
895
+ return () => createVNode(Fragment, null, [slots.default({
896
+ videoUrl: videoUrl.value,
897
+ loading: loading.value,
898
+ onDirectionControl,
899
+ onZoomControl
900
+ })]);
901
+ }
902
+ });
903
+
904
+ function useVideo(props) {
905
+ const activeIndex = ref$1(0);
906
+ const gridLayoutRef = ref$1();
907
+ const {
908
+ toggle: toggleFullscreen,
909
+ isFullscreen
910
+ } = useFullscreen(gridLayoutRef);
911
+ const render = () => createVNode(GridLayout, {
912
+ "ref": gridLayoutRef,
913
+ "gridNum": props.gridNum,
914
+ "activeIndex": activeIndex.value,
915
+ "onUpdate:activeIndex": ($event) => activeIndex.value = $event,
916
+ "showFn": (index) => !!props.deviceList[index]
917
+ }, {
918
+ default: ({
919
+ index
920
+ }) => {
921
+ const currentDevice = props.deviceList[index];
922
+ return createVNode(PlayerProvider, {
923
+ "deviceInfo": currentDevice
924
+ }, {
925
+ default: ({
926
+ videoUrl,
927
+ onDirectionControl,
928
+ onZoomControl,
929
+ loading
930
+ }) => createVNode(Player, {
931
+ "type": "live",
932
+ "loading": loading,
933
+ "videoUrl": videoUrl,
934
+ "title": currentDevice.deviceName,
935
+ "onDirectionControl": onDirectionControl,
936
+ "onZoomControl": onZoomControl,
937
+ "authType": currentDevice.authType === 2 ? ["control"] : []
938
+ }, null)
939
+ });
940
+ }
941
+ });
942
+ return {
943
+ render,
944
+ toggleFullscreen
945
+ };
946
+ }
947
+
948
+ var _sfc_main = /* @__PURE__ */ defineComponent({
949
+ __name: "index",
950
+ props: {
951
+ visible: { type: Boolean, required: true, default: false },
952
+ deviceList: { type: Array, required: true, default: () => [] },
953
+ gridNum: { type: Number, required: true, default: 4 }
954
+ },
955
+ emits: ["update:visible"],
956
+ setup(__props, { expose: __expose, emit: __emit }) {
957
+ __expose();
958
+ const props = __props;
959
+ const emit = __emit;
960
+ const dialogVisible = computed({
961
+ get: () => props.visible,
962
+ set: (val) => emit("update:visible", val)
963
+ });
964
+ const { render: Video, toggleFullscreen } = useVideo(props);
965
+ const videoDialogWidthClass = computed(() => {
966
+ let className = {};
967
+ switch (props.gridNum) {
968
+ case 1:
969
+ className = "one-video";
970
+ break;
971
+ case 4:
972
+ className = "four-video";
973
+ break;
974
+ case 9:
975
+ className = "nine-video";
976
+ break;
977
+ }
978
+ return className;
979
+ });
980
+ const __returned__ = { props, emit, dialogVisible, Video, toggleFullscreen, videoDialogWidthClass, get DasDialog() {
981
+ return DasDialog;
982
+ }, get DasIcon() {
983
+ return DasIcon;
984
+ }, get DasTooltip() {
985
+ return DasTooltip;
986
+ } };
987
+ Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
988
+ return __returned__;
989
+ }
990
+ });
991
+
992
+ const _hoisted_1 = /* @__PURE__ */ createElementVNode(
993
+ "div",
994
+ null,
995
+ [
996
+ /* @__PURE__ */ createElementVNode("span", null, "\u89C6\u9891\u76D1\u63A7")
997
+ ],
998
+ -1
999
+ /* HOISTED */
1000
+ );
1001
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1002
+ return openBlock(), createBlock($setup["DasDialog"], {
1003
+ size: "mini",
1004
+ title: "\u89C6\u9891\u76D1\u63A7",
1005
+ "custom-class": `das-linakge-video-dialog ${$setup.videoDialogWidthClass}`,
1006
+ modelValue: $setup.dialogVisible,
1007
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => $setup.dialogVisible = $event),
1008
+ bodyStyle: { padding: 0 },
1009
+ "close-on-click-modal": false,
1010
+ "close-on-press-escape": false,
1011
+ modal: false,
1012
+ "header-style": { display: "flex", justifyContent: "space-between", alignItems: "center" }
1013
+ }, {
1014
+ header: withCtx(() => [
1015
+ _hoisted_1,
1016
+ createVNode($setup["DasTooltip"], { content: "\u9875\u9762\u5168\u5C4F" }, {
1017
+ default: withCtx(() => [
1018
+ createVNode($setup["DasIcon"], {
1019
+ class: "icon",
1020
+ icon: "fullscreen2",
1021
+ color: "#999",
1022
+ onClick: $setup.toggleFullscreen
1023
+ }, null, 8, ["onClick"])
1024
+ ]),
1025
+ _: 1
1026
+ /* STABLE */
1027
+ })
1028
+ ]),
1029
+ default: withCtx(() => [
1030
+ $setup.dialogVisible ? (openBlock(), createBlock($setup["Video"], { key: 0 })) : createCommentVNode("v-if", true)
1031
+ ]),
1032
+ _: 1
1033
+ /* STABLE */
1034
+ }, 8, ["custom-class", "modelValue"]);
1035
+ }
1036
+ var videoDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "/Users/xiecp/das/das-fe/framework/packages/das-ui/packages/business-components/video-dialog/src/index.vue"]]);
1037
+
1038
+ const DasVideoDialog = withInstall(videoDialog);
1039
+ const DasVideoDialogRef = () => ref$1(null);
1040
+
1041
+ export { DasVideoDialog, DasVideoDialogRef, useVideo };