@nebulars/sseengine 1.3.63 → 1.3.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nebulars/sseengine",
3
3
  "description": "An engine for sse",
4
- "version": "1.3.63",
4
+ "version": "1.3.64",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
7
7
  "dev": "forage serve --name sseengine",
@@ -50,13 +50,8 @@ export default {
50
50
 
51
51
  // All
52
52
  if (checked) {
53
- // Get Snaps
54
- const snaps = $('[data-checked]')
55
- .map((_, e) => $(e).data())
56
- .get();
57
-
58
53
  // Checked All
59
- await this.$store.dispatch('sseengine/SNAP_ALL', snaps);
54
+ await this.$store.dispatch('sseengine/SNAP_ALL');
60
55
  }
61
56
 
62
57
  // Empty
package/src/store/snap.js CHANGED
@@ -1,4 +1,4 @@
1
- export default ({ http, link }) => {
1
+ export default ({ $, http, link }) => {
2
2
  return {
3
3
  async SNAP_MODE({}, mode = 'snap') {
4
4
  return { mode };
@@ -39,10 +39,20 @@ export default ({ http, link }) => {
39
39
  return { choosen };
40
40
  },
41
41
 
42
- async SNAP_ALL({ dispatch }, group = []) {
42
+ async SNAP_ALL({ dispatch }, group) {
43
+ // Group Reset
44
+ group = group || (await dispatch('SNAP_GROUP'));
45
+
46
+ // Group Loop
43
47
  group.forEach(async item => await dispatch('SNAP_ADD', item));
44
48
  },
45
49
 
50
+ async SNAP_GROUP({}) {
51
+ return $('[data-checked]')
52
+ .map((_, e) => $(e).data())
53
+ .get();
54
+ },
55
+
46
56
  async SNAP_CLEAN({ state }) {
47
57
  // Set Empty Choosen
48
58
  const choosen = [];
package/src/store/tub.js CHANGED
@@ -1,4 +1,4 @@
1
- export default ({ http, closest, copy, toimg, download, excel, toast, $ }) => {
1
+ export default ({ http, closest, copy, toimg, download, excel, time, toast, blob, $ }) => {
2
2
  return {
3
3
  async TUB_FULLSCREEN({ state }, { table }) {
4
4
  // Set Cloner
@@ -30,7 +30,23 @@ export default ({ http, closest, copy, toimg, download, excel, toast, $ }) => {
30
30
  const snap = await dispatch('SNAP_CREATE', table);
31
31
 
32
32
  // Set Snapshot
33
- const snapshot = true;
33
+ const snapshot = false;
34
+
35
+ // Set Image
36
+ const image = blob(snap);
37
+
38
+ // Copy
39
+ // copy(image);
40
+
41
+ // Copy Image
42
+ await navigator.clipboard.write([
43
+ new ClipboardItem({
44
+ [image.type]: image,
45
+ }),
46
+ ]);
47
+
48
+ // Toast
49
+ toast.success('图片已复制');
34
50
 
35
51
  // Update
36
52
  return {
@@ -62,11 +78,19 @@ export default ({ http, closest, copy, toimg, download, excel, toast, $ }) => {
62
78
 
63
79
  // Get ID
64
80
  // const query = closest(table, '[query-id]', true).getAttribute('query-id');
65
- const answer = closest(table, '[answer-id]', true).getAttribute('answer-id');
81
+ // const answer = closest(table, '[answer-id]', true).getAttribute('answer-id');
82
+
83
+ // Get Query
84
+ const query = closest(table, '[query-id]', true);
85
+
86
+ // Get Title from Query
87
+ const title = $(query).find('.fqa-query-content').html();
88
+
89
+ // Get Time
90
+ const fmt = time.Format(new Date(), 'YYYY-MM-DD');
66
91
 
67
92
  // Write Excel
68
- // excel.writeFile(book, `${answer}.xlsx`);
69
- excel.writeFile(book, `${state.info.title}.xlsx`);
93
+ excel.writeFile(book, `${title}_${fmt}.xlsx`);
70
94
  },
71
95
 
72
96
  async TSV_CREATE({}, { markdown, sup }) {