@adminforth/crud-approve-plugin 1.0.18 → 1.0.20

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/build.log CHANGED
@@ -11,5 +11,5 @@ custom/package.json
11
11
  custom/pnpm-lock.yaml
12
12
  custom/tsconfig.json
13
13
 
14
- sent 32,578 bytes received 134 bytes 65,424.00 bytes/sec
15
- total size is 32,075 speedup is 0.98
14
+ sent 32,790 bytes received 134 bytes 65,848.00 bytes/sec
15
+ total size is 32,287 speedup is 0.98
@@ -15,6 +15,7 @@ const theme = computed(() => coreStore.theme);
15
15
 
16
16
  const oldContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].oldRecord, null, 2)
17
17
  const newContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].newRecord, null, 2)
18
+ const hasChanges = oldContent !== newContent;
18
19
 
19
20
  const diffFile = ref();
20
21
 
@@ -43,8 +44,8 @@ async function sendApproveRequest(approved) {
43
44
 
44
45
  function initDiffFile() {
45
46
  const file = generateDiffFile(
46
- 'diff.json', oldContent.slice(2, -1),
47
- 'diff.json', newContent.slice(2, -1),
47
+ 'diff.json', oldContent,
48
+ 'diff.json', newContent,
48
49
  'json', 'json'
49
50
  );
50
51
  file.initTheme(theme.value === 'dark' ? 'dark' : 'light');
@@ -53,7 +54,9 @@ function initDiffFile() {
53
54
  diffFile.value = file;
54
55
  }
55
56
 
56
- initDiffFile();
57
+ if (hasChanges) {
58
+ initDiffFile();
59
+ }
57
60
 
58
61
  watch([theme], ([t]) => {
59
62
  if (!diffFile.value) return;
@@ -65,6 +68,7 @@ watch([theme], ([t]) => {
65
68
 
66
69
  <template>
67
70
  <DiffView
71
+ v-if="hasChanges"
68
72
  :diff-file="diffFile"
69
73
  :diff-view-mode="DiffModeEnum.Unified"
70
74
  :diff-view-theme="theme === 'dark' ? 'dark' : 'light'"
@@ -72,9 +76,9 @@ watch([theme], ([t]) => {
72
76
  :diff-view-wrap="true"
73
77
  :diff-view-font-size="14"
74
78
  />
79
+ <div v-else>No changes</div>
75
80
  <div v-if="record[meta.resourceColumns.statusColumnName] === 1" style="margin-top: 16px; display: flex; gap: 8px;">
76
81
  <Button style="background-color: green; color: white;" @click="sendApproveRequest(true)" :loader="false" class="w-full">Approve</Button>
77
82
  <Button style="background-color: red; color: white;" @click="sendApproveRequest(false)" :loader="false" class="w-full">Reject</Button>
78
83
  </div>
79
84
  </template>
80
-
@@ -18,6 +18,7 @@ const mode = computed(() => isMobile.value ? DiffModeEnum.Unified : DiffModeEnum
18
18
 
19
19
  const oldContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].oldRecord, null, 2)
20
20
  const newContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].newRecord, null, 2)
21
+ const hasChanges = oldContent !== newContent;
21
22
 
22
23
  const diffFile = ref();
23
24
 
@@ -58,7 +59,9 @@ function initDiffFile() {
58
59
  diffFile.value = file;
59
60
  }
60
61
 
61
- initDiffFile();
62
+ if (hasChanges) {
63
+ initDiffFile();
64
+ }
62
65
 
63
66
  watch([mode, theme], ([m, t]) => {
64
67
  if (!diffFile.value) return;
@@ -74,6 +77,7 @@ watch([mode, theme], ([m, t]) => {
74
77
 
75
78
  <template>
76
79
  <DiffView
80
+ v-if="hasChanges"
77
81
  :diff-file="diffFile"
78
82
  :diff-view-mode="mode"
79
83
  :diff-view-theme="theme === 'dark' ? 'dark' : 'light'"
@@ -81,9 +85,9 @@ watch([mode, theme], ([m, t]) => {
81
85
  :diff-view-wrap="true"
82
86
  :diff-view-font-size="14"
83
87
  />
88
+ <div v-else>No changes</div>
84
89
  <div v-if="record[meta.resourceColumns.statusColumnName] === 1" style="margin-top: 16px; display: flex; gap: 8px;">
85
90
  <Button style="background-color: green; color: white;" @click="sendApproveRequest(true)" :loader="false" class="w-full">Approve</Button>
86
91
  <Button style="background-color: red; color: white;" @click="sendApproveRequest(false)" :loader="false" class="w-full">Reject</Button>
87
92
  </div>
88
93
  </template>
89
-
@@ -15,6 +15,7 @@ const theme = computed(() => coreStore.theme);
15
15
 
16
16
  const oldContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].oldRecord, null, 2)
17
17
  const newContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].newRecord, null, 2)
18
+ const hasChanges = oldContent !== newContent;
18
19
 
19
20
  const diffFile = ref();
20
21
 
@@ -43,8 +44,8 @@ async function sendApproveRequest(approved) {
43
44
 
44
45
  function initDiffFile() {
45
46
  const file = generateDiffFile(
46
- 'diff.json', oldContent.slice(2, -1),
47
- 'diff.json', newContent.slice(2, -1),
47
+ 'diff.json', oldContent,
48
+ 'diff.json', newContent,
48
49
  'json', 'json'
49
50
  );
50
51
  file.initTheme(theme.value === 'dark' ? 'dark' : 'light');
@@ -53,7 +54,9 @@ function initDiffFile() {
53
54
  diffFile.value = file;
54
55
  }
55
56
 
56
- initDiffFile();
57
+ if (hasChanges) {
58
+ initDiffFile();
59
+ }
57
60
 
58
61
  watch([theme], ([t]) => {
59
62
  if (!diffFile.value) return;
@@ -65,6 +68,7 @@ watch([theme], ([t]) => {
65
68
 
66
69
  <template>
67
70
  <DiffView
71
+ v-if="hasChanges"
68
72
  :diff-file="diffFile"
69
73
  :diff-view-mode="DiffModeEnum.Unified"
70
74
  :diff-view-theme="theme === 'dark' ? 'dark' : 'light'"
@@ -72,9 +76,9 @@ watch([theme], ([t]) => {
72
76
  :diff-view-wrap="true"
73
77
  :diff-view-font-size="14"
74
78
  />
79
+ <div v-else>No changes</div>
75
80
  <div v-if="record[meta.resourceColumns.statusColumnName] === 1" style="margin-top: 16px; display: flex; gap: 8px;">
76
81
  <Button style="background-color: green; color: white;" @click="sendApproveRequest(true)" :loader="false" class="w-full">Approve</Button>
77
82
  <Button style="background-color: red; color: white;" @click="sendApproveRequest(false)" :loader="false" class="w-full">Reject</Button>
78
83
  </div>
79
84
  </template>
80
-
@@ -18,6 +18,7 @@ const mode = computed(() => isMobile.value ? DiffModeEnum.Unified : DiffModeEnum
18
18
 
19
19
  const oldContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].oldRecord, null, 2)
20
20
  const newContent = JSON.stringify(props.record[props.meta.resourceColumns.dataColumnName].newRecord, null, 2)
21
+ const hasChanges = oldContent !== newContent;
21
22
 
22
23
  const diffFile = ref();
23
24
 
@@ -58,7 +59,9 @@ function initDiffFile() {
58
59
  diffFile.value = file;
59
60
  }
60
61
 
61
- initDiffFile();
62
+ if (hasChanges) {
63
+ initDiffFile();
64
+ }
62
65
 
63
66
  watch([mode, theme], ([m, t]) => {
64
67
  if (!diffFile.value) return;
@@ -74,6 +77,7 @@ watch([mode, theme], ([m, t]) => {
74
77
 
75
78
  <template>
76
79
  <DiffView
80
+ v-if="hasChanges"
77
81
  :diff-file="diffFile"
78
82
  :diff-view-mode="mode"
79
83
  :diff-view-theme="theme === 'dark' ? 'dark' : 'light'"
@@ -81,9 +85,9 @@ watch([mode, theme], ([m, t]) => {
81
85
  :diff-view-wrap="true"
82
86
  :diff-view-font-size="14"
83
87
  />
88
+ <div v-else>No changes</div>
84
89
  <div v-if="record[meta.resourceColumns.statusColumnName] === 1" style="margin-top: 16px; display: flex; gap: 8px;">
85
90
  <Button style="background-color: green; color: white;" @click="sendApproveRequest(true)" :loader="false" class="w-full">Approve</Button>
86
91
  <Button style="background-color: red; color: white;" @click="sendApproveRequest(false)" :loader="false" class="w-full">Reject</Button>
87
92
  </div>
88
93
  </template>
89
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/crud-approve-plugin",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },