@netang/quasar 0.0.100 → 0.0.102

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 (164) hide show
  1. package/.editorconfig +12 -0
  2. package/LICENSE +21 -21
  3. package/README.md +11 -11
  4. package/_docs/docs/.vuepress/client.js +8 -8
  5. package/_docs/docs/.vuepress/config.js +40 -40
  6. package/_docs/docs/.vuepress/configs/index.js +2 -2
  7. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -1
  8. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -16
  9. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -1
  10. package/_docs/docs/.vuepress/configs/sidebar/zh.js +75 -75
  11. package/_docs/docs/.vuepress/public/css/index.css +3 -3
  12. package/_docs/docs/.vuepress/styles/index.scss +3 -3
  13. package/_docs/docs/components/column-title.md +25 -25
  14. package/_docs/docs/components/data.md +66 -66
  15. package/_docs/docs/components/dialog.md +59 -59
  16. package/_docs/docs/components/dragger.md +26 -26
  17. package/_docs/docs/components/editor-code.md +16 -16
  18. package/_docs/docs/components/empty.md +13 -13
  19. package/_docs/docs/components/field-date.md +16 -16
  20. package/_docs/docs/components/field-text.md +57 -57
  21. package/_docs/docs/components/field-tree.md +21 -21
  22. package/_docs/docs/components/img.md +25 -25
  23. package/_docs/docs/components/input-number.md +21 -21
  24. package/_docs/docs/components/list-menu-item.md +21 -21
  25. package/_docs/docs/components/list-menu.md +21 -21
  26. package/_docs/docs/components/power-page.md +21 -21
  27. package/_docs/docs/components/price.md +21 -21
  28. package/_docs/docs/components/render.md +12 -12
  29. package/_docs/docs/components/search-item.md +10 -10
  30. package/_docs/docs/components/search.md +12 -12
  31. package/_docs/docs/components/select.md +11 -11
  32. package/_docs/docs/components/splitter.md +15 -15
  33. package/_docs/docs/components/table-column-fixed.md +20 -20
  34. package/_docs/docs/components/table-pagination.md +20 -20
  35. package/_docs/docs/components/table-splitter.md +20 -20
  36. package/_docs/docs/components/table-summary.md +20 -20
  37. package/_docs/docs/components/table.md +25 -25
  38. package/_docs/docs/components/thumbnail.md +18 -18
  39. package/_docs/docs/components/toolbar.md +9 -9
  40. package/_docs/docs/components/uploader-query.md +19 -19
  41. package/_docs/docs/components/uploader.md +16 -16
  42. package/_docs/docs/components/value-format.md +26 -26
  43. package/_docs/docs/index.md +1 -1
  44. package/_docs/docs/utils/alert.md +26 -26
  45. package/_docs/docs/utils/area.md +112 -112
  46. package/_docs/docs/utils/arr.md +80 -80
  47. package/_docs/docs/utils/auth.md +101 -101
  48. package/_docs/docs/utils/bus.md +18 -18
  49. package/_docs/docs/utils/confirm.md +31 -31
  50. package/_docs/docs/utils/copy.md +22 -22
  51. package/_docs/docs/utils/dialog.md +98 -98
  52. package/_docs/docs/utils/dict.md +50 -50
  53. package/_docs/docs/utils/dictOptions.md +27 -27
  54. package/_docs/docs/utils/form.md +33 -33
  55. package/_docs/docs/utils/getData.md +60 -60
  56. package/_docs/docs/utils/getFile.md +21 -21
  57. package/_docs/docs/utils/getImage.md +33 -33
  58. package/_docs/docs/utils/getTime.md +51 -51
  59. package/_docs/docs/utils/index.md +1 -1
  60. package/_docs/docs/utils/loading.md +18 -18
  61. package/_docs/docs/utils/notify.md +29 -29
  62. package/_docs/docs/utils/power.md +353 -353
  63. package/_docs/docs/utils/previewImage.md +11 -11
  64. package/_docs/docs/utils/price.md +45 -45
  65. package/_docs/docs/utils/rule.md +30 -30
  66. package/_docs/docs/utils/ruleValid.md +31 -31
  67. package/_docs/docs/utils/symbols.md +30 -30
  68. package/_docs/docs/utils/table.md +194 -194
  69. package/_docs/docs/utils/timestamp.md +27 -27
  70. package/_docs/docs/utils/toast.md +27 -27
  71. package/_docs/docs/utils/tree.md +174 -174
  72. package/_docs/docs/utils/uploader.md +29 -29
  73. package/_docs/package.json +11 -11
  74. package/components/column-title/index.vue +37 -37
  75. package/components/data/index.vue +20 -20
  76. package/components/dialog/index.vue +372 -372
  77. package/components/dragger/index.vue +203 -203
  78. package/components/drawer/index.vue +303 -303
  79. package/components/editor-code/index.vue +289 -289
  80. package/components/empty/index.vue +71 -71
  81. package/components/field-date/index.vue +850 -850
  82. package/components/field-date/methods.js +100 -100
  83. package/components/field-table/index.vue +1222 -1195
  84. package/components/field-text/index.vue +165 -165
  85. package/components/field-tree/index.vue +739 -659
  86. package/components/img/index.vue +202 -202
  87. package/components/input-number/index.vue +546 -546
  88. package/components/list-menu/index.vue +149 -149
  89. package/components/list-menu-item/index.vue +79 -79
  90. package/components/power-page/index.vue +92 -92
  91. package/components/price/index.vue +188 -188
  92. package/components/private/components/index.js +11 -11
  93. package/components/private/components/move-to-tree/index.vue +154 -154
  94. package/components/private/edit-power-data/index.vue +816 -816
  95. package/components/private/table-visible-columns-button/index.vue +109 -109
  96. package/components/render/index.vue +150 -150
  97. package/components/search/index.vue +222 -222
  98. package/components/search-item/index.vue +210 -210
  99. package/components/select/index.vue +177 -177
  100. package/components/splitter/index.vue +415 -415
  101. package/components/table/index.vue +456 -456
  102. package/components/table-column-fixed/index.vue +112 -112
  103. package/components/table-pagination/index.vue +192 -192
  104. package/components/table-splitter/index.vue +360 -360
  105. package/components/table-summary/index.vue +110 -110
  106. package/components/thumbnail/index.vue +72 -72
  107. package/components/toolbar/container.vue +31 -31
  108. package/components/toolbar/index.vue +136 -136
  109. package/components/uploader/index.vue +158 -158
  110. package/components/uploader-query/index.vue +758 -758
  111. package/components/value-format/index.vue +274 -274
  112. package/configs/area3.js +1 -1
  113. package/docs/css/index.css +3 -3
  114. package/package.json +24 -24
  115. package/sass/common.scss +174 -174
  116. package/sass/index.scss +14 -14
  117. package/sass/line.scss +39 -39
  118. package/sass/quasar/btn.scss +46 -46
  119. package/sass/quasar/common.scss +3 -3
  120. package/sass/quasar/dialog.scss +7 -7
  121. package/sass/quasar/drawer.scss +6 -6
  122. package/sass/quasar/field.scss +243 -243
  123. package/sass/quasar/loading.scss +6 -6
  124. package/sass/quasar/menu.scss +8 -8
  125. package/sass/quasar/table.scss +150 -150
  126. package/sass/quasar/toolbar.scss +22 -22
  127. package/store/index.js +29 -29
  128. package/utils/$auth.js +127 -127
  129. package/utils/$form.js +56 -56
  130. package/utils/$power.js +1215 -1215
  131. package/utils/$rule.js +13 -13
  132. package/utils/$ruleValid.js +10 -10
  133. package/utils/$table.js +999 -999
  134. package/utils/$tree.js +713 -713
  135. package/utils/alert.js +12 -12
  136. package/utils/area.js +400 -400
  137. package/utils/arr.js +51 -51
  138. package/utils/bus.js +6 -6
  139. package/utils/config.js +52 -52
  140. package/utils/confirm.js +11 -11
  141. package/utils/copy.js +30 -30
  142. package/utils/dialog.js +36 -36
  143. package/utils/dict.js +21 -21
  144. package/utils/dictOptions.js +28 -28
  145. package/utils/getData.js +73 -73
  146. package/utils/getFile.js +40 -40
  147. package/utils/getImage.js +153 -153
  148. package/utils/getTime.js +106 -106
  149. package/utils/index.js +61 -61
  150. package/utils/loading.js +15 -15
  151. package/utils/notify.js +13 -13
  152. package/utils/previewImage.js +10 -10
  153. package/utils/price.js +18 -18
  154. package/utils/symbols.js +18 -18
  155. package/utils/timestamp.js +18 -18
  156. package/utils/toast.js +13 -13
  157. package/utils/uploader/aliyun.js +6 -6
  158. package/utils/uploader/local.js +8 -8
  159. package/utils/uploader/qiniu.js +321 -321
  160. package/utils/uploader.js +1059 -1059
  161. package/utils/useAuth.js +30 -30
  162. package/utils/useRouter.js +47 -47
  163. package/utils/useSearch.js +496 -496
  164. package/utils/useUploader.js +53 -53
@@ -1,360 +1,360 @@
1
- <template>
2
- <n-splitter
3
- class="absolute-full"
4
- v-model="currentValue"
5
- :reverse="reverse"
6
- :unit="unit"
7
- :limits="limits"
8
- :horizontal="horizontal"
9
-
10
- v-model:after="currentAfter"
11
- @update:after="setSelection"
12
- :hide-after-in-mobile="hideAfterInMobile"
13
- :cache="cache"
14
- >
15
- <!-- 表格 -->
16
- <template v-slot:before="{ after, toggleAfter }">
17
- <n-table
18
- v-bind="$attrs"
19
- >
20
- <!-- 工具栏右边插槽(手机端不显示) -->
21
- <template #toolbar-right v-if="isWatcher">
22
-
23
- <!-- 工具栏右边插槽 -->
24
- <slot name="toolbar-right" />
25
-
26
- <!-- 是否显示详情 -->
27
- <q-toggle
28
- icon="apps"
29
- :model-value="after"
30
- @click="toggleAfter"
31
- >
32
- <q-tooltip anchor="center left" self="center right" :offset="[10, 0]">{{tooltip}}</q-tooltip>
33
- </q-toggle>
34
-
35
- </template>
36
-
37
- <!-- 插槽 -->
38
- <template
39
- v-for="slotName in slotNames"
40
- v-slot:[slotName]="props"
41
- >
42
- <!-- 有传参的插槽 -->
43
- <slot
44
- :name="slotName"
45
- v-bind="props"
46
- v-if="props"
47
- />
48
-
49
- <!-- 无传参的插槽 -->
50
- <slot
51
- :name="slotName"
52
- v-else
53
- />
54
- </template>
55
-
56
- </n-table>
57
- </template>
58
-
59
- <!-- 渲染详情页面(手机端不显示) -->
60
- <template v-slot:after>
61
-
62
- <!-- 渲染 -->
63
- <n-render
64
- :path="renderPath"
65
- :query="currentQuery"
66
- v-if="currentQuery"
67
- />
68
-
69
- <!-- 空状态 -->
70
- <n-empty
71
- :description="renderDescription"
72
- fit
73
- v-else
74
- />
75
-
76
- </template>
77
-
78
- </n-splitter>
79
- </template>
80
-
81
- <script>
82
- import { nextTick, ref, watch, computed, inject } from 'vue'
83
- import { useQuasar } from 'quasar'
84
-
85
- import $n_isFunction from 'lodash/isFunction'
86
-
87
- import $n_isValidObject from '@netang/utils/isValidObject'
88
-
89
- import NSplitter from '../splitter'
90
- import NTable from '../table'
91
- import NRender from '../render'
92
- import NEmpty from '../empty'
93
-
94
- import { NTableKey } from '../../utils/symbols'
95
-
96
- export default {
97
-
98
- /**
99
- * 关闭组件 attribute 透传行为
100
- */
101
- inheritAttrs: false,
102
-
103
- /**
104
- * 标识
105
- */
106
- name: 'NTableSplitter',
107
-
108
- /**
109
- * 组件
110
- */
111
- components: {
112
- NSplitter,
113
- NTable,
114
- NRender,
115
- NEmpty,
116
- },
117
-
118
- /**
119
- * 声明属性
120
- */
121
- props: {
122
- // 值 v-model
123
- modelValue: {
124
- type: Number,
125
- default: 50,
126
- },
127
- // 反转插槽
128
- reverse: Boolean,
129
- // 模型的 CSS 单位
130
- unit: String,
131
- // 两个值的数组,表示两个面板的最小和最大分割大小
132
- limits: Array,
133
- // 是否水平拆分
134
- horizontal: Boolean,
135
-
136
- // 显示后置插槽 v-model:after
137
- // 注意: 如果非双向绑定, 如 :after 并不会影响内部值变化, 仅做初始值使用
138
- after: {
139
- type: Boolean,
140
- default: true,
141
- },
142
- // 手机模式隐藏后插槽
143
- hideAfterInMobile: {
144
- type: Boolean,
145
- default: true,
146
- },
147
- // 是否开启缓存
148
- cache: {
149
- type: [ Boolean, String ],
150
- default: true,
151
- },
152
-
153
- // 工具提示
154
- tooltip: {
155
- type: String,
156
- default: '是否显示详情',
157
- },
158
- // 渲染组件路径
159
- renderPath: {
160
- type: String,
161
- required: true,
162
- },
163
- // 格式化已选表格的数据并返回渲染组件参数
164
- renderQuery: Function,
165
- // 渲染空状态描述
166
- renderDescription: {
167
- type: String,
168
- default: '没有找到任何数据',
169
- },
170
- // 不需要加载渲染页面标识参数
171
- // 额外加载参数 { n_renderpage: 1 }
172
- noRendPageName: Boolean,
173
- },
174
-
175
- /**
176
- * 声明事件
177
- */
178
- emits: [
179
- 'update:modelValue',
180
- 'update:after',
181
- ],
182
-
183
- /**
184
- * 组合式
185
- */
186
- setup(props, { emit, slots }) {
187
-
188
- // ==========【计算属性】=========================================================================================
189
-
190
- /**
191
- * 插槽标识
192
- */
193
- const slotNames = computed(function() {
194
- return $n_isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
195
- })
196
-
197
- /**
198
- * 是否监听
199
- */
200
- const isWatcher = computed(function () {
201
- return ! props.hideAfterInMobile || ! $q.platform.is.mobile
202
- })
203
-
204
- /**
205
- * 当前传参
206
- */
207
- const currentQuery = computed(function() {
208
-
209
- // 如果有已选数据
210
- if (
211
- currentSelectedItem.value
212
- && $n_isFunction(props.renderQuery)
213
- ) {
214
- const resQuery = props.renderQuery(currentSelectedItem.value)
215
- if ($n_isValidObject(resQuery)) {
216
-
217
- // 如果需要加载渲染页面标识参数
218
- if (! props.noRendPageName) {
219
- // 格式化已选数据, 并返回参数
220
- return Object.assign({}, resQuery, {
221
- // 是否为渲染页面
222
- n_renderpage: 1,
223
- })
224
- }
225
-
226
- return resQuery
227
- }
228
- }
229
-
230
- return null
231
- })
232
-
233
- // ==========【数据】=============================================================================================
234
-
235
- // quasar 对象
236
- const $q = useQuasar()
237
-
238
- // 获取表格注入
239
- const $table = inject(NTableKey)
240
-
241
- // 原始表格选择状态
242
- const rawTableSelection = $table.tableSelection.value
243
-
244
- // 当前已选单条数据
245
- const currentSelectedItem = ref(null)
246
-
247
- // 当前值
248
- const currentValue = ref(props.modelValue)
249
-
250
- // 当前显示前置插槽
251
- const currentAfter = ref(props.after)
252
-
253
- // ==========【监听数据】=========================================================================================
254
-
255
- /**
256
- * 监听声明值
257
- */
258
- watch(() => props.modelValue, function (val) {
259
- currentValue.value = val
260
- })
261
-
262
- /**
263
- * 监听声明显示前置插槽
264
- */
265
- watch(() => props.after, function (val) {
266
- currentAfter.value = val
267
- })
268
-
269
- /**
270
- * 监听当前值
271
- */
272
- watch(currentValue, function (val) {
273
- emit('update:modelValue', val)
274
- })
275
-
276
- /**
277
- * 监听当前显示前置插槽
278
- */
279
- watch(currentAfter, function (val) {
280
- emit('update:after', val)
281
- })
282
-
283
- /**
284
- * 监听表格已选数据(非手机端有效)
285
- */
286
- watch($table.tableSelected, async function (selected) {
287
-
288
- // 先清空当前已选单条数据
289
- currentSelectedItem.value = null
290
-
291
- // 如果不监听
292
- if (! isWatcher.value) {
293
-
294
- // 则无需任何操作
295
- return
296
- }
297
-
298
- // 下次 DOM 更新
299
- await nextTick()
300
-
301
- // 如果有已选单条数据
302
- if (selected.length === 1) {
303
-
304
- // 设置当前已选数据
305
- currentSelectedItem.value = selected[0]
306
- }
307
-
308
- }, {
309
- // 深度监听
310
- deep: true,
311
- })
312
-
313
- // ==========【方法】============================================================================================
314
-
315
- /**
316
- * 设置表格选择类型
317
- */
318
- function setSelection(showAfter) {
319
-
320
- // 如果不监听
321
- if (! isWatcher.value) {
322
-
323
- // 则无需任何操作
324
- return
325
- }
326
-
327
- const selection = showAfter ? 'single' : rawTableSelection
328
- if ($table.tableSelection.value !== selection) {
329
- $table.tableSelection.value = selection
330
-
331
- // 如果显示后置插槽
332
- if (showAfter && $table.tableSelected.value.length > 1) {
333
-
334
- // 如果有多条已选数据, 则只取第一条数据
335
- $table.tableSelected.value = [ $table.tableSelected.value[$table.tableSelected.value.length - 1] ]
336
- }
337
- }
338
- }
339
-
340
- // ==========【返回】=========================================================================================
341
-
342
- return {
343
- // 插槽标识
344
- slotNames,
345
- // 是否监听
346
- isWatcher,
347
- // 当前传参
348
- currentQuery,
349
-
350
- // 当前值
351
- currentValue,
352
- // 当前显示前置插槽
353
- currentAfter,
354
-
355
- // 设置表格选择类型
356
- setSelection,
357
- }
358
- }
359
- }
360
- </script>
1
+ <template>
2
+ <n-splitter
3
+ class="absolute-full"
4
+ v-model="currentValue"
5
+ :reverse="reverse"
6
+ :unit="unit"
7
+ :limits="limits"
8
+ :horizontal="horizontal"
9
+
10
+ v-model:after="currentAfter"
11
+ @update:after="setSelection"
12
+ :hide-after-in-mobile="hideAfterInMobile"
13
+ :cache="cache"
14
+ >
15
+ <!-- 表格 -->
16
+ <template v-slot:before="{ after, toggleAfter }">
17
+ <n-table
18
+ v-bind="$attrs"
19
+ >
20
+ <!-- 工具栏右边插槽(手机端不显示) -->
21
+ <template #toolbar-right v-if="isWatcher">
22
+
23
+ <!-- 工具栏右边插槽 -->
24
+ <slot name="toolbar-right" />
25
+
26
+ <!-- 是否显示详情 -->
27
+ <q-toggle
28
+ icon="apps"
29
+ :model-value="after"
30
+ @click="toggleAfter"
31
+ >
32
+ <q-tooltip anchor="center left" self="center right" :offset="[10, 0]">{{tooltip}}</q-tooltip>
33
+ </q-toggle>
34
+
35
+ </template>
36
+
37
+ <!-- 插槽 -->
38
+ <template
39
+ v-for="slotName in slotNames"
40
+ v-slot:[slotName]="props"
41
+ >
42
+ <!-- 有传参的插槽 -->
43
+ <slot
44
+ :name="slotName"
45
+ v-bind="props"
46
+ v-if="props"
47
+ />
48
+
49
+ <!-- 无传参的插槽 -->
50
+ <slot
51
+ :name="slotName"
52
+ v-else
53
+ />
54
+ </template>
55
+
56
+ </n-table>
57
+ </template>
58
+
59
+ <!-- 渲染详情页面(手机端不显示) -->
60
+ <template v-slot:after>
61
+
62
+ <!-- 渲染 -->
63
+ <n-render
64
+ :path="renderPath"
65
+ :query="currentQuery"
66
+ v-if="currentQuery"
67
+ />
68
+
69
+ <!-- 空状态 -->
70
+ <n-empty
71
+ :description="renderDescription"
72
+ fit
73
+ v-else
74
+ />
75
+
76
+ </template>
77
+
78
+ </n-splitter>
79
+ </template>
80
+
81
+ <script>
82
+ import { nextTick, ref, watch, computed, inject } from 'vue'
83
+ import { useQuasar } from 'quasar'
84
+
85
+ import $n_isFunction from 'lodash/isFunction'
86
+
87
+ import $n_isValidObject from '@netang/utils/isValidObject'
88
+
89
+ import NSplitter from '../splitter'
90
+ import NTable from '../table'
91
+ import NRender from '../render'
92
+ import NEmpty from '../empty'
93
+
94
+ import { NTableKey } from '../../utils/symbols'
95
+
96
+ export default {
97
+
98
+ /**
99
+ * 关闭组件 attribute 透传行为
100
+ */
101
+ inheritAttrs: false,
102
+
103
+ /**
104
+ * 标识
105
+ */
106
+ name: 'NTableSplitter',
107
+
108
+ /**
109
+ * 组件
110
+ */
111
+ components: {
112
+ NSplitter,
113
+ NTable,
114
+ NRender,
115
+ NEmpty,
116
+ },
117
+
118
+ /**
119
+ * 声明属性
120
+ */
121
+ props: {
122
+ // 值 v-model
123
+ modelValue: {
124
+ type: Number,
125
+ default: 50,
126
+ },
127
+ // 反转插槽
128
+ reverse: Boolean,
129
+ // 模型的 CSS 单位
130
+ unit: String,
131
+ // 两个值的数组,表示两个面板的最小和最大分割大小
132
+ limits: Array,
133
+ // 是否水平拆分
134
+ horizontal: Boolean,
135
+
136
+ // 显示后置插槽 v-model:after
137
+ // 注意: 如果非双向绑定, 如 :after 并不会影响内部值变化, 仅做初始值使用
138
+ after: {
139
+ type: Boolean,
140
+ default: true,
141
+ },
142
+ // 手机模式隐藏后插槽
143
+ hideAfterInMobile: {
144
+ type: Boolean,
145
+ default: true,
146
+ },
147
+ // 是否开启缓存
148
+ cache: {
149
+ type: [ Boolean, String ],
150
+ default: true,
151
+ },
152
+
153
+ // 工具提示
154
+ tooltip: {
155
+ type: String,
156
+ default: '是否显示详情',
157
+ },
158
+ // 渲染组件路径
159
+ renderPath: {
160
+ type: String,
161
+ required: true,
162
+ },
163
+ // 格式化已选表格的数据并返回渲染组件参数
164
+ renderQuery: Function,
165
+ // 渲染空状态描述
166
+ renderDescription: {
167
+ type: String,
168
+ default: '没有找到任何数据',
169
+ },
170
+ // 不需要加载渲染页面标识参数
171
+ // 额外加载参数 { n_renderpage: 1 }
172
+ noRendPageName: Boolean,
173
+ },
174
+
175
+ /**
176
+ * 声明事件
177
+ */
178
+ emits: [
179
+ 'update:modelValue',
180
+ 'update:after',
181
+ ],
182
+
183
+ /**
184
+ * 组合式
185
+ */
186
+ setup(props, { emit, slots }) {
187
+
188
+ // ==========【计算属性】=========================================================================================
189
+
190
+ /**
191
+ * 插槽标识
192
+ */
193
+ const slotNames = computed(function() {
194
+ return $n_isValidObject(slots) ? Object.keys(slots).filter(e => e !== 'toolbar-right') : []
195
+ })
196
+
197
+ /**
198
+ * 是否监听
199
+ */
200
+ const isWatcher = computed(function () {
201
+ return ! props.hideAfterInMobile || ! $q.platform.is.mobile
202
+ })
203
+
204
+ /**
205
+ * 当前传参
206
+ */
207
+ const currentQuery = computed(function() {
208
+
209
+ // 如果有已选数据
210
+ if (
211
+ currentSelectedItem.value
212
+ && $n_isFunction(props.renderQuery)
213
+ ) {
214
+ const resQuery = props.renderQuery(currentSelectedItem.value)
215
+ if ($n_isValidObject(resQuery)) {
216
+
217
+ // 如果需要加载渲染页面标识参数
218
+ if (! props.noRendPageName) {
219
+ // 格式化已选数据, 并返回参数
220
+ return Object.assign({}, resQuery, {
221
+ // 是否为渲染页面
222
+ n_renderpage: 1,
223
+ })
224
+ }
225
+
226
+ return resQuery
227
+ }
228
+ }
229
+
230
+ return null
231
+ })
232
+
233
+ // ==========【数据】=============================================================================================
234
+
235
+ // quasar 对象
236
+ const $q = useQuasar()
237
+
238
+ // 获取表格注入
239
+ const $table = inject(NTableKey)
240
+
241
+ // 原始表格选择状态
242
+ const rawTableSelection = $table.tableSelection.value
243
+
244
+ // 当前已选单条数据
245
+ const currentSelectedItem = ref(null)
246
+
247
+ // 当前值
248
+ const currentValue = ref(props.modelValue)
249
+
250
+ // 当前显示前置插槽
251
+ const currentAfter = ref(props.after)
252
+
253
+ // ==========【监听数据】=========================================================================================
254
+
255
+ /**
256
+ * 监听声明值
257
+ */
258
+ watch(() => props.modelValue, function (val) {
259
+ currentValue.value = val
260
+ })
261
+
262
+ /**
263
+ * 监听声明显示前置插槽
264
+ */
265
+ watch(() => props.after, function (val) {
266
+ currentAfter.value = val
267
+ })
268
+
269
+ /**
270
+ * 监听当前值
271
+ */
272
+ watch(currentValue, function (val) {
273
+ emit('update:modelValue', val)
274
+ })
275
+
276
+ /**
277
+ * 监听当前显示前置插槽
278
+ */
279
+ watch(currentAfter, function (val) {
280
+ emit('update:after', val)
281
+ })
282
+
283
+ /**
284
+ * 监听表格已选数据(非手机端有效)
285
+ */
286
+ watch($table.tableSelected, async function (selected) {
287
+
288
+ // 先清空当前已选单条数据
289
+ currentSelectedItem.value = null
290
+
291
+ // 如果不监听
292
+ if (! isWatcher.value) {
293
+
294
+ // 则无需任何操作
295
+ return
296
+ }
297
+
298
+ // 下次 DOM 更新
299
+ await nextTick()
300
+
301
+ // 如果有已选单条数据
302
+ if (selected.length === 1) {
303
+
304
+ // 设置当前已选数据
305
+ currentSelectedItem.value = selected[0]
306
+ }
307
+
308
+ }, {
309
+ // 深度监听
310
+ deep: true,
311
+ })
312
+
313
+ // ==========【方法】============================================================================================
314
+
315
+ /**
316
+ * 设置表格选择类型
317
+ */
318
+ function setSelection(showAfter) {
319
+
320
+ // 如果不监听
321
+ if (! isWatcher.value) {
322
+
323
+ // 则无需任何操作
324
+ return
325
+ }
326
+
327
+ const selection = showAfter ? 'single' : rawTableSelection
328
+ if ($table.tableSelection.value !== selection) {
329
+ $table.tableSelection.value = selection
330
+
331
+ // 如果显示后置插槽
332
+ if (showAfter && $table.tableSelected.value.length > 1) {
333
+
334
+ // 如果有多条已选数据, 则只取第一条数据
335
+ $table.tableSelected.value = [ $table.tableSelected.value[$table.tableSelected.value.length - 1] ]
336
+ }
337
+ }
338
+ }
339
+
340
+ // ==========【返回】=========================================================================================
341
+
342
+ return {
343
+ // 插槽标识
344
+ slotNames,
345
+ // 是否监听
346
+ isWatcher,
347
+ // 当前传参
348
+ currentQuery,
349
+
350
+ // 当前值
351
+ currentValue,
352
+ // 当前显示前置插槽
353
+ currentAfter,
354
+
355
+ // 设置表格选择类型
356
+ setSelection,
357
+ }
358
+ }
359
+ }
360
+ </script>