quasar-ui-sellmate-ui-kit 3.9.7 → 3.9.8

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,6 +1,6 @@
1
1
  {
2
2
  "name": "quasar-ui-sellmate-ui-kit",
3
- "version": "3.9.7",
3
+ "version": "3.9.8",
4
4
  "author": "Sellmate Dev Team <dev@sellmate.co.kr>",
5
5
  "description": "Sellmate UI Kit",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div
3
- class="s-table-tree"
3
+ class="s-table-tree bg-white"
4
4
  :class="{
5
5
  'sticky-table-tree': isStickyFirstColumn,
6
6
  'loading-table-tree': loading,
@@ -12,7 +12,7 @@
12
12
  <q-inner-loading showing color="positive" size="72px" />
13
13
  </slot>
14
14
 
15
- <div class="s-table-tree__inner" ref="scrollLocationRef" @scroll="handleScroll" >
15
+ <div class="s-table-tree__inner" ref="scrollLocationRef" @scroll="handleScroll">
16
16
  <table>
17
17
  <thead>
18
18
  <tr>
@@ -54,7 +54,7 @@
54
54
  :colspan="columns.length"
55
55
  :resizedWidths="resizedWidths"
56
56
  ref="childTableNode"
57
- @handlerExpand="handlerExpand"
57
+ @handleExpand="handleExpand"
58
58
  >
59
59
  <template
60
60
  v-for="column in columns"
@@ -92,24 +92,24 @@
92
92
  </template>
93
93
 
94
94
  <script>
95
- import { defineComponent, ref, onMounted, nextTick } from 'vue';
95
+ import { defineComponent, ref, onMounted, nextTick, watch } from 'vue';
96
96
  import { QInnerLoading } from 'quasar';
97
97
  import TableTreeNode from './TableTreeNode.vue';
98
98
  import { useResizableTree } from '../composables/table/use-resizable-tree';
99
99
 
100
100
  function setWidthForExpand(tableNodeRef, resizedWidths) {
101
101
  const tableElements = tableNodeRef.querySelectorAll('table');
102
-
102
+
103
103
  tableElements.forEach(tableElement => {
104
- const rows = tableElement.querySelectorAll('tr');
105
- rows.forEach(row => {
106
- const cols = row.children;
107
- for (let i = 0; i < cols.length; i++) {
108
- if (resizedWidths[i] !== undefined) {
109
- cols[i].style.minWidth = `${resizedWidths[i]}px`;
110
- cols[i].style.width = `${resizedWidths[i]}px`;
111
- }
104
+ const rows = tableElement.querySelectorAll('tr');
105
+ rows.forEach(row => {
106
+ const cols = row.children;
107
+ for (let i = 0; i < cols.length; i++) {
108
+ if (resizedWidths[i] !== undefined) {
109
+ cols[i].style.minWidth = `${resizedWidths[i]}px`;
110
+ cols[i].style.width = `${resizedWidths[i]}px`;
112
111
  }
112
+ }
113
113
  });
114
114
  });
115
115
  }
@@ -151,21 +151,20 @@
151
151
  required: false,
152
152
  },
153
153
  },
154
- setup(props) {
154
+ setup(props, { emit }) {
155
155
  const treeDataSource = ref([]);
156
156
  const sTableTreeRef = ref(null);
157
157
  const resizedWidths = ref({});
158
- const scrollLocationRef = ref(null)
158
+ const scrollLocationRef = ref(null);
159
159
 
160
160
  function handleScroll() {
161
161
  const { scrollLeft } = scrollLocationRef.value;
162
-
162
+
163
163
  if (scrollLeft === 0) {
164
164
  scrollLocationRef.value.classList.add('no-before');
165
165
  } else {
166
166
  scrollLocationRef.value.classList.remove('no-before');
167
167
  }
168
-
169
168
  }
170
169
 
171
170
  function initTreeData() {
@@ -188,14 +187,16 @@
188
187
  reduceDataFunc(tempData, 1);
189
188
  treeDataSource.value = tempData;
190
189
  }
190
+ initTreeData();
191
191
 
192
- function handlerExpand(row) {
192
+ function handleExpand(row) {
193
193
  row.isExpand = !row.isExpand;
194
-
194
+ if (row.isExpand) emit('handleExpand', row);
195
+
195
196
  nextTick(() => {
196
197
  setWidthForExpand(sTableTreeRef.value, resizedWidths.value);
197
- });
198
- };
198
+ });
199
+ }
199
200
 
200
201
  onMounted(() => {
201
202
  const { addResizable } = useResizableTree();
@@ -205,11 +206,16 @@
205
206
  scrollLocationRef.value.classList.add('no-before');
206
207
  });
207
208
 
208
- initTreeData();
209
+ watch(
210
+ () => props.rows,
211
+ () => {
212
+ initTreeData();
213
+ },
214
+ );
209
215
 
210
216
  return {
211
217
  treeDataSource,
212
- handlerExpand,
218
+ handleExpand,
213
219
  handleScroll,
214
220
  sTableTreeRef,
215
221
  scrollLocationRef,
@@ -235,9 +241,10 @@
235
241
  }
236
242
  .s-table-tree__inner {
237
243
  overflow: auto;
238
- td, th {
244
+ td,
245
+ th {
239
246
  width: 100%;
240
- &:not(:first-of-type){
247
+ &:not(:first-of-type) {
241
248
  word-break: keep-all;
242
249
  white-space: nowrap;
243
250
  text-overflow: ellipsis;
@@ -263,9 +270,9 @@
263
270
  }
264
271
  tbody {
265
272
  > tr {
266
- td{
267
- height: 44px;
268
- }
273
+ td {
274
+ height: 44px;
275
+ }
269
276
  > .body-td {
270
277
  padding: 0;
271
278
  }
@@ -274,9 +281,9 @@
274
281
  tfoot {
275
282
  border-top: 2px solid $Grey_Lighten-3 !important;
276
283
  tr {
277
- &:last-of-type{
284
+ &:last-of-type {
278
285
  background: rgba(245, 250, 255, 1);
279
- .td-1{
286
+ .td-1 {
280
287
  color: $Blue_B_Lighten-2;
281
288
  }
282
289
  }
@@ -297,13 +304,14 @@
297
304
 
298
305
  &.sticky-table-tree {
299
306
  .s-table-tree__inner {
300
- td, th {
301
- width: 100%;
302
- &:not(:first-of-type){
303
- word-break: keep-all;
304
- white-space: nowrap;
305
- text-overflow: ellipsis;
306
- overflow: hidden;
307
+ td,
308
+ th {
309
+ width: 100%;
310
+ &:not(:first-of-type) {
311
+ word-break: keep-all;
312
+ white-space: nowrap;
313
+ text-overflow: ellipsis;
314
+ overflow: hidden;
307
315
  }
308
316
  }
309
317
  table {
@@ -378,10 +386,10 @@
378
386
  }
379
387
  }
380
388
  }
381
- &:last-of-type{
389
+ &:last-of-type {
382
390
  background: rgba(245, 250, 255, 1);
383
- .td-1{
384
- color: $Blue_B_Lighten-2;
391
+ .td-1 {
392
+ color: $Blue_B_Lighten-2;
385
393
  background: rgba(245, 250, 255, 1);
386
394
  }
387
395
  }
@@ -395,7 +403,7 @@
395
403
  th {
396
404
  &:first-of-type {
397
405
  &::before {
398
- display: none;
406
+ display: none;
399
407
  }
400
408
  }
401
409
  }
@@ -409,8 +417,8 @@
409
417
  tr {
410
418
  td {
411
419
  &:first-of-type {
412
- &::before{
413
- display: none;
420
+ &::before {
421
+ display: none;
414
422
  }
415
423
  }
416
424
  }
@@ -425,7 +433,7 @@
425
433
  td {
426
434
  &:first-of-type {
427
435
  &::before {
428
- display: none;
436
+ display: none;
429
437
  }
430
438
  }
431
439
  }
@@ -10,10 +10,7 @@
10
10
  'bg-Grey_Lighten-5': !hasChildren,
11
11
  [`td-${i + 1} text-${column.align}`]: i >= 0,
12
12
  }"
13
- :style="[
14
- i === 0 && `padding-left: ${row.leftPadding}px`,
15
- `width: ${column.width}px`
16
- ]"
13
+ :style="[i === 0 && `padding-left: ${row.leftPadding}px`, `width: ${column.width}px`]"
17
14
  >
18
15
  <slot :name="`body-cell-${column.name}`">
19
16
  <div>
@@ -25,15 +22,12 @@
25
22
  :color="row.isExpand ? 'Blue_C_Lighten-3' : 'Grey_Default'"
26
23
  class="expand-btn q-mr-sm"
27
24
  :class="{ 'not-expand-btn': !row.isExpand }"
28
- @click="handlerExpand(row)"
25
+ @click="handleExpand(row)"
29
26
  />
30
27
 
31
- <span
32
- class="cell-content"
33
- :class="{'is-root': isRoot}"
34
- >
28
+ <span class="cell-content" :class="{ 'is-root': isRoot }">
35
29
  <span v-if="column.prefix" class="q-mr-xs">{{ column.prefix }}</span>
36
- {{ row[column.name] }}
30
+ {{ row[column.name] }}
37
31
  <span v-if="column.suffix" class="q-ml-xs">{{ column.suffix }}</span>
38
32
  </span>
39
33
  </div>
@@ -53,7 +47,7 @@
53
47
  :columns="columns"
54
48
  :colspan="colspan"
55
49
  :resizedWidths="resizedWidths"
56
- @handlerExpand="handlerExpand"
50
+ @handleExpand="handleExpand"
57
51
  :is-root="false"
58
52
  >
59
53
  <template
@@ -81,9 +75,9 @@
81
75
  type: Array,
82
76
  default: () => [],
83
77
  },
84
- isRoot:{
78
+ isRoot: {
85
79
  type: Boolean,
86
- default: true
80
+ default: true,
87
81
  },
88
82
  colspan: Number,
89
83
  resizedWidths: Object,
@@ -93,17 +87,17 @@
93
87
  const hasChildren = computed(() => props.row.children && props.row.children.length > 0);
94
88
  const childTableNode = ref(null);
95
89
 
96
- function handlerExpand(row) {;
97
- emit('handlerExpand', row);
90
+ function handleExpand(row) {
91
+ emit('handleExpand', row);
98
92
  }
99
93
 
100
94
  return {
101
95
  levelClass,
102
96
  hasChildren,
103
- handlerExpand,
97
+ handleExpand,
104
98
  childTableNode,
105
99
  addIcon10,
106
- minusIcon10
100
+ minusIcon10,
107
101
  };
108
102
  },
109
103
  });
@@ -127,9 +121,10 @@
127
121
  padding: 0 16px;
128
122
  }
129
123
  }
130
- td,th{
124
+ td,
125
+ th {
131
126
  width: 100%;
132
- &:not(:first-of-type){
127
+ &:not(:first-of-type) {
133
128
  word-break: keep-all;
134
129
  white-space: nowrap;
135
130
  overflow: hidden;
@@ -146,7 +141,7 @@
146
141
  height: 44px;
147
142
  padding: 0 16px;
148
143
  font-weight: 400;
149
-
144
+
150
145
  .expand-btn {
151
146
  min-width: 20px;
152
147
  min-height: 20px;
@@ -175,7 +170,7 @@
175
170
  font-weight: 700;
176
171
  }
177
172
  .td-1 :not(.is-root) {
178
- font-weight: 400;
173
+ font-weight: 400;
179
174
  }
180
175
  }
181
176
  }