|
49 | 49 | </div> |
50 | 50 | </div> |
51 | 51 | </div> |
| 52 | + <DefineSuspenseLoading v-slot="{ $slots }"> |
| 53 | + <Suspense :timeout="0"> |
| 54 | + <template #fallback> |
| 55 | + <div class="input-group-text"> |
| 56 | + <div class="spinner-border" role="status"> |
| 57 | + <span class="visually-hidden">Loading...</span> |
| 58 | + </div> |
| 59 | + </div> |
| 60 | + </template> |
| 61 | + <component :is="$slots.default" /> |
| 62 | + </Suspense> |
| 63 | + </DefineSuspenseLoading> |
52 | 64 | <div class="query-params"> |
53 | 65 | <div v-for="(p, pI) in params" :key="pI" class="input-group"> |
54 | 66 | <button @click="deleteParam(pI)" class="btn btn-link" type="button"> |
|
68 | 80 | </div> |
69 | 81 | </div> |
70 | 82 | <template v-if="p.name === 'fid'"> |
71 | | - <WidgetSelectForum v-model.number="p.value" class="flex-grow-0 w-50"> |
72 | | - <template #indicators="{ renderer }"> |
73 | | - <span class="input-group-text"><RenderFunction :renderer="renderer" /></span> |
74 | | - </template> |
75 | | - </WidgetSelectForum> |
| 83 | + <ReuseSuspenseLoading> |
| 84 | + <LazyWidgetSelectForum v-model.number="p.value" class="flex-grow-0 w-50"> |
| 85 | + <template #indicators="{ renderer }"> |
| 86 | + <div class="input-group-text"><RenderFunction :renderer="renderer" /></div> |
| 87 | + </template> |
| 88 | + </LazyWidgetSelectForum> |
| 89 | + </ReuseSuspenseLoading> |
76 | 90 | </template> |
77 | 91 | <template v-if="isPostIDParam(p)"> |
78 | | - <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
79 | | - <LazyPostQueryFormWidgetInputNumericParam |
80 | | - @update:modelValue="onParamUpdate(pI, $event)" |
81 | | - :modelValue="params[pI] as KnownNumericParams" |
82 | | - :placeholders="getPostIDParamPlaceholders(p)" /> |
| 92 | + <ReuseSuspenseLoading> |
| 93 | + <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
| 94 | + </ReuseSuspenseLoading> |
| 95 | + <ReuseSuspenseLoading> |
| 96 | + <LazyPostQueryFormWidgetInputNumericParam |
| 97 | + @update:modelValue="onParamUpdate(pI, $event)" |
| 98 | + :modelValue="params[pI] as KnownNumericParams" |
| 99 | + :placeholders="getPostIDParamPlaceholders(p)" /> |
| 100 | + </ReuseSuspenseLoading> |
83 | 101 | </template> |
84 | 102 | <template v-if="isDateTimeParam(p)"> |
85 | | - <LazyARangePicker |
86 | | - v-model:value="p.subParam.range" showTime |
87 | | - format="YYYY-MM-DD HH:mm" valueFormat="YYYY-MM-DDTHH:mm" size="large" /> |
| 103 | + <ReuseSuspenseLoading> |
| 104 | + <LazyARangePicker |
| 105 | + v-model:value="p.subParam.range" showTime |
| 106 | + format="YYYY-MM-DD HH:mm" valueFormat="YYYY-MM-DDTHH:mm" size="large" /> |
| 107 | + </ReuseSuspenseLoading> |
88 | 108 | </template> |
89 | 109 | <template v-if="isTextParam(p)"> |
90 | 110 | <input |
91 | 111 | v-model="p.value" :placeholder="inputTextParamPlaceholder(p)" |
92 | 112 | type="text" class="form-control" required /> |
93 | | - <PostQueryFormWidgetInputTextParam |
94 | | - @update:modelValue="onParamUpdate(pI, $event)" |
95 | | - :modelValue="params[pI] as KnownTextParams" |
96 | | - :paramIndex="pI" /> |
| 113 | + <ReuseSuspenseLoading> |
| 114 | + <LazyPostQueryFormWidgetInputTextParam |
| 115 | + @update:modelValue="onParamUpdate(pI, $event)" |
| 116 | + :modelValue="params[pI] as KnownTextParams" |
| 117 | + :paramIndex="pI" /> |
| 118 | + </ReuseSuspenseLoading> |
97 | 119 | </template> |
98 | 120 | <template |
99 | 121 | v-if=" // https://github.com/microsoft/TypeScript/issues/51678 |
100 | 122 | p.name === 'threadViewCount' |
101 | 123 | || p.name === 'threadShareCount' |
102 | 124 | || p.name === 'threadReplyCount' |
103 | 125 | || p.name === 'replySubReplyCount'"> |
104 | | - <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
105 | | - <LazyPostQueryFormWidgetInputNumericParam |
106 | | - @update:modelValue="onParamUpdate(pI, $event)" |
107 | | - :modelValue="params[pI] as KnownNumericParams" |
108 | | - :paramIndex="pI" |
109 | | - :placeholders="{ IN: '100,101,102,...', BETWEEN: '100,200', equals: '100' }" /> |
| 126 | + <ReuseSuspenseLoading> |
| 127 | + <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
| 128 | + </ReuseSuspenseLoading> |
| 129 | + <ReuseSuspenseLoading> |
| 130 | + <LazyPostQueryFormWidgetInputNumericParam |
| 131 | + @update:modelValue="onParamUpdate(pI, $event)" |
| 132 | + :modelValue="params[pI] as KnownNumericParams" |
| 133 | + :paramIndex="pI" |
| 134 | + :placeholders="{ IN: '100,101,102,...', BETWEEN: '100,200', equals: '100' }" /> |
| 135 | + </ReuseSuspenseLoading> |
110 | 136 | </template> |
111 | 137 | <template v-if="p.name === 'threadProperties'"> |
112 | 138 | <div v-for="property in ['good', 'sticky']" :key="property" class="input-group-text"> |
|
124 | 150 | </div> |
125 | 151 | </template> |
126 | 152 | <template v-if="p.name === 'authorUid' || p.name === 'latestReplierUid'"> |
127 | | - <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
128 | | - <LazyPostQueryFormWidgetInputNumericParam |
129 | | - @update:modelValue="onParamUpdate(pI, $event)" |
130 | | - :modelValue="params[pI] as KnownNumericParams" |
131 | | - :placeholders="uidParamsPlaceholder" /> |
| 153 | + <ReuseSuspenseLoading> |
| 154 | + <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
| 155 | + </ReuseSuspenseLoading> |
| 156 | + <ReuseSuspenseLoading> |
| 157 | + <LazyPostQueryFormWidgetInputNumericParam |
| 158 | + @update:modelValue="onParamUpdate(pI, $event)" |
| 159 | + :modelValue="params[pI] as KnownNumericParams" |
| 160 | + :placeholders="uidParamsPlaceholder" /> |
| 161 | + </ReuseSuspenseLoading> |
132 | 162 | </template> |
133 | 163 | <template v-if="p.name === 'authorManagerType'"> |
134 | 164 | <select v-model="p.value" class="form-control flex-grow-0 w-25"> |
|
149 | 179 | </select> |
150 | 180 | </template> |
151 | 181 | <template v-if="p.name === 'authorExpGrade'"> |
152 | | - <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
153 | | - <LazyPostQueryFormWidgetInputNumericParam |
154 | | - @update:modelValue="onParamUpdate(pI, $event)" |
155 | | - :modelValue="params[pI] as KnownNumericParams" |
156 | | - :placeholders="{ IN: '9,10,11,...', BETWEEN: '9,18', equals: '18' }" /> |
| 182 | + <ReuseSuspenseLoading> |
| 183 | + <LazyPostQueryFormWidgetSelectRange v-model="p.subParam.range" /> |
| 184 | + </ReuseSuspenseLoading> |
| 185 | + <ReuseSuspenseLoading> |
| 186 | + <LazyPostQueryFormWidgetInputNumericParam |
| 187 | + @update:modelValue="onParamUpdate(pI, $event)" |
| 188 | + :modelValue="params[pI] as KnownNumericParams" |
| 189 | + :placeholders="{ IN: '9,10,11,...', BETWEEN: '9,18', equals: '18' }" /> |
| 190 | + </ReuseSuspenseLoading> |
157 | 191 | </template> |
158 | 192 | </div> |
159 | 193 | </div> |
@@ -198,6 +232,7 @@ const { // https://github.com/orgs/vuejs/discussions/6147 |
198 | 232 | changeParam, |
199 | 233 | deleteParam |
200 | 234 | } = queryFormDeps; |
| 235 | +const [DefineSuspenseLoading, ReuseSuspenseLoading] = createReusableTemplate(); |
201 | 236 |
|
202 | 237 | const getPostIDParamPlaceholders = (p: Param) => ({ |
203 | 238 | IN: p.name === 'tid' ? '5000000000,5000000001,5000000002,...' : '15000000000,15000000001,15000000002,...', |
@@ -275,4 +310,8 @@ watch(() => uniqueParams.value.postTypes.value, (to, from) => { |
275 | 310 | padding-inline-start: 22px; |
276 | 311 | padding-inline-end: 10px; |
277 | 312 | } |
| 313 | +.spinner-border { |
| 314 | + height: 1.5rem; |
| 315 | + width: 1.5rem; |
| 316 | +} |
278 | 317 | </style> |
0 commit comments