sun-biz 0.0.2-beta.20 → 0.0.2-beta.22

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 (66) hide show
  1. package/package.json +1 -1
  2. package/dist/components/biz-select/dict-select/api.d.ts +0 -24
  3. package/dist/components/biz-select/index.d.ts +0 -3
  4. package/dist/components/copy-text-with-tooltip/index.d.ts +0 -1
  5. package/dist/components/form-design-render/api/index.d.ts +0 -27
  6. package/dist/components/form-design-render/index.d.ts +0 -2
  7. package/dist/components/form-design-render/utils.d.ts +0 -89
  8. package/dist/components/index.d.ts +0 -10
  9. package/dist/components/index.js +0 -4857
  10. package/dist/components/invoice/index.d.ts +0 -2
  11. package/dist/components/patient-access/api.d.ts +0 -18
  12. package/dist/components/patient-access/index.d.ts +0 -5
  13. package/dist/components/print/api/index.d.ts +0 -37
  14. package/dist/components/print/api/request.d.ts +0 -7
  15. package/dist/components/print/constant.d.ts +0 -133
  16. package/dist/components/print/hooks/index.d.ts +0 -22
  17. package/dist/components/print/index.d.ts +0 -7
  18. package/dist/components/pro-dialog/hooks/useDialog.d.ts +0 -8
  19. package/dist/components/pro-dialog/index.d.ts +0 -1
  20. package/dist/components/pro-form/index.d.ts +0 -3
  21. package/dist/components/pro-form/typings/index.d.ts +0 -53
  22. package/dist/components/pro-form/utils.d.ts +0 -12
  23. package/dist/components/pro-form/wubiUtils.d.ts +0 -1
  24. package/dist/components/pro-table/composables/dbgrid-component-setting/api/index.d.ts +0 -33
  25. package/dist/components/pro-table/composables/dbgrid-component-setting/typings/index.d.ts +0 -70
  26. package/dist/components/pro-table/index.d.ts +0 -5
  27. package/dist/components/pro-table/interface/index.d.ts +0 -82
  28. package/dist/components/pro-table/utils.d.ts +0 -39
  29. package/dist/components/static/css/index.css +0 -22
  30. package/dist/components/title/index.d.ts +0 -1
  31. package/dist/hooks/index.d.ts +0 -5
  32. package/dist/hooks/index.js +0 -470
  33. package/dist/hooks/use-app-config/index.d.ts +0 -29
  34. package/dist/hooks/use-app-config/types.d.ts +0 -33
  35. package/dist/hooks/use-column&form-config/index.d.ts +0 -15
  36. package/dist/hooks/use-direction-select/index.d.ts +0 -63
  37. package/dist/hooks/use-fetch-dataset/index.d.ts +0 -12
  38. package/dist/hooks/use-request/Fetch.d.ts +0 -41
  39. package/dist/hooks/use-request/config.d.ts +0 -6
  40. package/dist/hooks/use-request/index.d.ts +0 -5
  41. package/dist/hooks/use-request/plugins/useAutoRunPlugin.d.ts +0 -3
  42. package/dist/hooks/use-request/plugins/useCachePlugin.d.ts +0 -3
  43. package/dist/hooks/use-request/plugins/useDebouncePlugin.d.ts +0 -3
  44. package/dist/hooks/use-request/plugins/useLoadingDelayPlugin.d.ts +0 -3
  45. package/dist/hooks/use-request/plugins/usePollingPlugin.d.ts +0 -3
  46. package/dist/hooks/use-request/plugins/useRefreshOnWindowFocusPlugin.d.ts +0 -3
  47. package/dist/hooks/use-request/plugins/useRetryPlugin.d.ts +0 -3
  48. package/dist/hooks/use-request/types.d.ts +0 -251
  49. package/dist/hooks/use-request/useRequest.d.ts +0 -7
  50. package/dist/hooks/use-request/useRequestImplement.d.ts +0 -3
  51. package/dist/hooks/use-request/useRequestProvider.d.ts +0 -2
  52. package/dist/hooks/use-request/utils/cache.d.ts +0 -17
  53. package/dist/hooks/use-request/utils/cachePromise.d.ts +0 -4
  54. package/dist/hooks/use-request/utils/cacheSubscribe.d.ts +0 -5
  55. package/dist/hooks/use-request/utils/index.d.ts +0 -6
  56. package/dist/hooks/use-request/utils/isDocumentVisible.d.ts +0 -1
  57. package/dist/hooks/use-request/utils/isOnline.d.ts +0 -1
  58. package/dist/hooks/use-request/utils/limit.d.ts +0 -1
  59. package/dist/hooks/use-request/utils/resolve-args.d.ts +0 -2
  60. package/dist/hooks/use-request/utils/subscribeFocus.d.ts +0 -3
  61. package/dist/hooks/use-request/utils/subscribeReVisible.d.ts +0 -2
  62. package/dist/hooks/use-request/utils/utils.d.ts +0 -3
  63. package/dist/index.d.ts +0 -18
  64. package/dist/index.js +0 -5277
  65. package/dist/static/css/index.css +0 -22
  66. package/dist/utils.d.ts +0 -19
@@ -1,470 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
2
- import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__ from "@sun-toolkit/request";
3
- import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__ from "@sun-toolkit/enums";
4
- import * as __WEBPACK_EXTERNAL_MODULE_i18next_vue__ from "i18next-vue";
5
- /* eslint-disable @typescript-eslint/no-explicit-any */ // support refreshDeps & ready
6
- const useAutoRunPlugin = (fetchInstance, { manual, ready = true, refreshDeps = [], refreshDepsAction })=>{
7
- const hasAutoRun = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
8
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
9
- if (!manual && true !== fetchInstance.options.refreshDeps) hasAutoRun.value = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready);
10
- });
11
- if (refreshDeps instanceof Array) (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)([
12
- hasAutoRun,
13
- ...refreshDeps
14
- ], ([autoRun])=>{
15
- if (!autoRun) return;
16
- if (!manual && autoRun) {
17
- if (refreshDepsAction) refreshDepsAction();
18
- else fetchInstance.refresh();
19
- }
20
- }, {
21
- deep: true,
22
- immediate: false
23
- });
24
- else (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(hasAutoRun, (h)=>{
25
- if (!manual && h) {
26
- if (refreshDepsAction) refreshDepsAction();
27
- else fetchInstance.refresh();
28
- }
29
- });
30
- return {
31
- name: 'autoRunPlugin',
32
- onBefore: ()=>{
33
- if (!(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready)) return {
34
- stopNow: true
35
- };
36
- }
37
- };
38
- };
39
- useAutoRunPlugin.onInit = ({ ready = true, manual })=>({
40
- loading: !manual && (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready)
41
- });
42
- /* ESM default export */ const plugins_useAutoRunPlugin = useAutoRunPlugin;
43
- // eslint-disable-next-line @typescript-eslint/ban-types
44
- const isFunction = (value)=>'function' == typeof value;
45
- const isBoolean = (value)=>'boolean' == typeof value;
46
- /* eslint-disable @typescript-eslint/no-explicit-any */ class Fetch {
47
- serviceRef;
48
- options;
49
- setUpdateData;
50
- initState;
51
- pluginImpls;
52
- count;
53
- state;
54
- previousValidData;
55
- constructor(serviceRef, options, setUpdateData, initState = {}){
56
- this.serviceRef = serviceRef;
57
- this.options = options;
58
- this.setUpdateData = setUpdateData;
59
- this.initState = initState;
60
- this.count = 0;
61
- this.state = {
62
- loading: false,
63
- total: 0,
64
- params: void 0,
65
- restData: void 0,
66
- data: void 0,
67
- error: void 0
68
- };
69
- this.previousValidData = void 0;
70
- this.state = {
71
- ...this.state,
72
- loading: !options.manual,
73
- ...initState
74
- };
75
- }
76
- /**
77
- * set state
78
- * @param currentState currentState
79
- */ setState(currentState = {}) {
80
- this.state = {
81
- ...this.state,
82
- ...currentState
83
- };
84
- this.setUpdateData(this.state);
85
- }
86
- /**
87
- * should rename
88
- * @param data Result value `unknown`
89
- * @param key Result key `data`| `params` | `loading`| `error`
90
- */ setData(data, key) {
91
- console.warn("Please use 'setFetchState' instead of 'setData'");
92
- if (key instanceof Array) key.forEach((k)=>{
93
- this.state[k] = data;
94
- this.setUpdateData(data, k);
95
- });
96
- else {
97
- this.state[key] = data;
98
- this.setUpdateData(data, key);
99
- }
100
- }
101
- /**
102
- *
103
- * @param data Result value `unknown`
104
- * @param key Result key `data`| `params` | `loading`| `error`
105
- */ setFetchState(data, key) {
106
- if (key instanceof Array) key.forEach((k)=>{
107
- this.state[k] = data;
108
- this.setUpdateData(data, k);
109
- });
110
- else {
111
- this.state[key] = data;
112
- this.setUpdateData(data, key);
113
- }
114
- }
115
- /**
116
- * Traverse the plugin that needs to be run,
117
- * which is a callback function for the plugin to obtain fetch instances and execute plugin logic at the corresponding nodes.
118
- */ runPluginHandler(event, ...rest) {
119
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
120
- // @ts-ignore
121
- const r = (this.pluginImpls?.map((i)=>i[event]?.(...rest)) ?? [])?.filter(Boolean);
122
- return Object.assign({}, ...r);
123
- }
124
- // Asynchronous request
125
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
126
- // @ts-ignore
127
- async runAsync(...params) {
128
- this.count += 1;
129
- const currentCount = this.count;
130
- const { stopNow = false, returnNow = false, ...state } = this.runPluginHandler('onBefore', params);
131
- // Do you want to stop the request
132
- if (stopNow) return new Promise(()=>{});
133
- this.setState({
134
- loading: true,
135
- params,
136
- ...state
137
- });
138
- // Do you want to return immediately
139
- if (returnNow) return Promise.resolve(state.data);
140
- // The 'onBefore' configuration item error no longer interrupts the entire code flow
141
- try {
142
- // Return before request
143
- this.options.onBefore?.(params);
144
- } catch (error) {
145
- // The 'onBefore' configuration item error no longer interrupts the entire code flow
146
- this.setState({
147
- error,
148
- loading: false
149
- });
150
- this.options.onError?.(error, params);
151
- this.runPluginHandler('onError', error, params);
152
- // Manually intercept the error and return a Promise with an empty status
153
- return new Promise(()=>{});
154
- }
155
- try {
156
- // Start the request with the replace service, if it contains the onRequest event name
157
- let { servicePromise } = this.runPluginHandler('onRequest', this.serviceRef.value, params);
158
- const requestReturnResponse = (res)=>{
159
- // The request has been cancelled, and the count will be inconsistent with the currentCount
160
- if (currentCount !== this.count) return new Promise(()=>{});
161
- // Format data
162
- const formattedResult = this.options.formatResult ? this.options.formatResult(res) : res;
163
- const { data, total, restData } = res;
164
- this.setState({
165
- data,
166
- total,
167
- restData,
168
- error: void 0,
169
- loading: false
170
- });
171
- // Request successful
172
- this.options.onSuccess?.(formattedResult, params);
173
- this.runPluginHandler('onSuccess', formattedResult, params);
174
- this.previousValidData = formattedResult;
175
- // Execute whether the request is successful or unsuccessful
176
- this.options.onFinally?.(params, formattedResult, void 0);
177
- if (currentCount === this.count) this.runPluginHandler('onFinally', params, formattedResult, void 0);
178
- return formattedResult;
179
- };
180
- if (!servicePromise) servicePromise = this.serviceRef.value(...params);
181
- const [error, servicePromiseResult] = await servicePromise;
182
- if (error) throw error;
183
- return requestReturnResponse(servicePromiseResult);
184
- } catch (error) {
185
- if (currentCount !== this.count) return new Promise(()=>{});
186
- this.setState({
187
- error,
188
- loading: false
189
- });
190
- this.options.onError?.(error, params);
191
- this.runPluginHandler('onError', error, params);
192
- // rollback
193
- if (isFunction(this.options?.rollbackOnError) && this.options?.rollbackOnError(params) || isBoolean(this.options?.rollbackOnError) && this.options.rollbackOnError) this.setState({
194
- data: this.previousValidData
195
- });
196
- // Execute whether the request is successful or unsuccessful
197
- this.options.onFinally?.(params, void 0, error);
198
- if (currentCount === this.count) this.runPluginHandler('onFinally', params, void 0, error);
199
- throw error;
200
- }
201
- }
202
- run(...params) {
203
- this.runAsync(...params).catch((error)=>{
204
- if (!this.options.onError) console.error(error);
205
- });
206
- }
207
- cancel() {
208
- this.count += 1;
209
- this.setState({
210
- loading: false
211
- });
212
- this.runPluginHandler('onCancel');
213
- }
214
- refresh() {
215
- this.run(...this.state.params || []);
216
- }
217
- refreshAsync() {
218
- return this.runAsync(...this.state.params || []);
219
- }
220
- mutate(data) {
221
- const targetData = isFunction(data) ? data(this.state.data) : data;
222
- this.runPluginHandler('onMutate', targetData);
223
- this.setState({
224
- data: targetData
225
- });
226
- }
227
- }
228
- const config_USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY = Symbol('USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY');
229
- /* eslint-disable @typescript-eslint/no-explicit-any */ function isUseRequestFetchState(state) {
230
- const keys = Object.keys(state);
231
- return 4 === keys.filter((i)=>[
232
- 'data',
233
- 'loading',
234
- 'params',
235
- 'error'
236
- ].includes(i)).length;
237
- }
238
- function useRequestImplement(service, options = {}, plugins = []) {
239
- // global option
240
- const USEREQUEST_GLOBAL_OPTIONS = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)(config_USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY, {});
241
- // read option
242
- const { initialData, manual = false, ready = true, ...rest } = {
243
- ...USEREQUEST_GLOBAL_OPTIONS ?? {},
244
- ...options ?? {}
245
- };
246
- const fetchOptions = {
247
- manual,
248
- ready,
249
- initialData,
250
- ...rest
251
- };
252
- // serviceRef store service
253
- const serviceRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(service);
254
- // reactive
255
- const state = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
256
- data: initialData,
257
- loading: false,
258
- total: 0,
259
- restData: void 0,
260
- params: void 0,
261
- error: void 0
262
- });
263
- const setState = (currentState, field)=>{
264
- if (field) state[field] = currentState;
265
- else if (isUseRequestFetchState(currentState)) {
266
- state.data = currentState.data;
267
- state.loading = currentState.loading;
268
- state.error = currentState.error;
269
- state.params = currentState.params;
270
- if (currentState.total) state.total = currentState.total;
271
- if (currentState.restData) state.restData = currentState.restData;
272
- }
273
- };
274
- const initState = plugins.map((p)=>p?.onInit?.(fetchOptions)).filter(Boolean);
275
- // Fetch Instance
276
- const fetchInstance = new Fetch(serviceRef, fetchOptions, setState, Object.assign({}, ...initState, state));
277
- fetchInstance.options = fetchOptions;
278
- // run plugins
279
- fetchInstance.pluginImpls = plugins.map((p)=>p(fetchInstance, fetchOptions));
280
- const readyComputed = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.isRef)(ready) ? ready.value : ready);
281
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect)(()=>{
282
- if (!manual) {
283
- const params = fetchInstance.state.params || options.defaultParams || [];
284
- // auto collect
285
- if (readyComputed.value && true === fetchInstance.options.refreshDeps && !!serviceRef.value) fetchInstance.run(...params);
286
- }
287
- });
288
- // manual
289
- if (!manual && true !== fetchInstance.options.refreshDeps) {
290
- const params = fetchInstance.state.params || options.defaultParams || [];
291
- if ((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(ready)) fetchInstance.run(...params);
292
- }
293
- // onUnmounted cancel request
294
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.onScopeDispose)(()=>{
295
- fetchInstance.cancel();
296
- });
297
- return {
298
- ...(0, __WEBPACK_EXTERNAL_MODULE_vue__.toRefs)(state),
299
- cancel: fetchInstance.cancel.bind(fetchInstance),
300
- refresh: fetchInstance.refresh.bind(fetchInstance),
301
- refreshAsync: fetchInstance.refreshAsync.bind(fetchInstance),
302
- run: fetchInstance.run.bind(fetchInstance),
303
- runAsync: fetchInstance.runAsync.bind(fetchInstance),
304
- mutate: fetchInstance.mutate.bind(fetchInstance)
305
- };
306
- }
307
- /* ESM default export */ const use_request_useRequestImplement = useRequestImplement;
308
- const withArgs = (hook, use)=>function(service, options = {}, plugins = []) {
309
- let next = hook;
310
- const middleware = use || [];
311
- for(let i = middleware.length; i--;)next = middleware[i](next);
312
- return next(service, options, plugins);
313
- };
314
- /* eslint-disable @typescript-eslint/no-explicit-any */ // import useCachePlugin from './plugins/useCachePlugin';
315
- // import useDebouncePlugin from './plugins/useDebouncePlugin';
316
- // import useDevtoolsPlugin from './plugins/useDevtoolsPlugin';
317
- // import useLoadingDelayPlugin from './plugins/useLoadingDelayPlugin';
318
- // import usePollingPlugin from './plugins/usePollingPlugin';
319
- // import useRefreshOnWindowFocusPlugin from './plugins/useRefreshOnWindowFocusPlugin';
320
- // import useRetryPlugin from './plugins/useRetryPlugin';
321
- // import useThrottlePlugin from './plugins/useThrottlePlugin';
322
- function useRequest_useRequest(service, options, plugins) {
323
- const BuiltInPlugins = [
324
- // process?.env?.NODE_ENV === 'development' ? useDevtoolsPlugin : null,
325
- // useDebouncePlugin,
326
- // useLoadingDelayPlugin,
327
- // usePollingPlugin,
328
- // useRefreshOnWindowFocusPlugin,
329
- // useThrottlePlugin,
330
- plugins_useAutoRunPlugin
331
- ].filter(Boolean);
332
- return withArgs(use_request_useRequestImplement, options?.use)(service, options, [
333
- ...plugins || [],
334
- ...BuiltInPlugins
335
- ]);
336
- }
337
- /* ESM default export */ const useRequest = useRequest_useRequest;
338
- /* eslint-disable @typescript-eslint/no-explicit-any */ new Map();
339
- /* ESM default export */ const use_request = useRequest;
340
- /**
341
- * 获取主应用配置信息
342
- */ var use_app_config_MAIN_APP_CONFIG = /*#__PURE__*/ function(MAIN_APP_CONFIG) {
343
- /**
344
- * 当前激活菜单ID
345
- */ MAIN_APP_CONFIG["MENU_ID"] = "menuId";
346
- /**
347
- * 当前账号医院列表
348
- */ MAIN_APP_CONFIG["HOSPITAL_LIST"] = "hospitalList";
349
- /**
350
- * 当前账号组织信息
351
- */ MAIN_APP_CONFIG["CURRENT_ORG"] = "currentOrg";
352
- /**
353
- * 是否是云环境
354
- */ MAIN_APP_CONFIG["IS_CLOUD_ENV"] = "isCloudEnv";
355
- /**
356
- * 是否为 sass 模式
357
- */ MAIN_APP_CONFIG["IS_SASS_MODE"] = "isSassMode";
358
- return MAIN_APP_CONFIG;
359
- }({});
360
- function useAppConfigData(name) {
361
- const data = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('mainAppConfig');
362
- if (Array.isArray(name)) return name.reduce((acc, key)=>{
363
- if (data && key in data) acc[key] = data[key];
364
- return acc;
365
- }, {});
366
- return data?.[name];
367
- }
368
- /* ESM default export */ const use_app_config = useAppConfigData;
369
- function unrefElement(elRef) {
370
- const plain = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(elRef);
371
- return plain?.$el ?? plain;
372
- }
373
- function findActiveIndexByDirection(options) {
374
- const { data, direction, column, activeItem, rowKey: rowKeyValue, scrollTo } = options;
375
- const rowKey = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(rowKeyValue);
376
- let currentIndex = data.findIndex((item)=>item[rowKey] === activeItem?.[rowKey]);
377
- const isYDirection = "ArrowUp" === direction || "ArrowDown" === direction;
378
- if (column) {
379
- if ("ArrowUp" === direction) currentIndex = Math.max(0, currentIndex - column);
380
- else if ("ArrowDown" === direction) currentIndex = Math.min(data.length - 1, currentIndex + column);
381
- if ("ArrowLeft" === direction) currentIndex = (currentIndex - 1 + data.length) % data.length;
382
- else if ("ArrowRight" === direction) currentIndex = (currentIndex + 1) % data.length;
383
- } else if ("ArrowUp" === direction) currentIndex = (currentIndex - 1 + data.length) % data.length;
384
- else if ("ArrowDown" === direction) currentIndex = (currentIndex + 1) % data.length;
385
- if (scrollTo && -1 !== currentIndex && isYDirection) scrollTo(Math.floor(currentIndex / (column || 1)));
386
- return currentIndex;
387
- }
388
- function useSelectByDirectionEvent(options) {
389
- const { triggerRef, scrollTo, data, activeItem, rowKey, column, rowHeight = 36, setCurrentItem, enter } = options;
390
- const handleKeydown = (event)=>{
391
- const { code } = event;
392
- if (enter && "Enter" === code) {
393
- enter(event);
394
- return;
395
- }
396
- const directionData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(data);
397
- const currentIndex = findActiveIndexByDirection({
398
- data: directionData || [],
399
- activeItem: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(activeItem) ?? directionData?.[0],
400
- rowKey,
401
- direction: code,
402
- column,
403
- scrollTo: (index)=>{
404
- scrollTo({
405
- top: rowHeight * index,
406
- left: 0,
407
- behavior: 'smooth'
408
- });
409
- }
410
- });
411
- if (-1 !== currentIndex && directionData?.[currentIndex]) {
412
- if (setCurrentItem) setCurrentItem(directionData[currentIndex]);
413
- }
414
- };
415
- const cleanups = [];
416
- const cleanup = ()=>{
417
- cleanups.forEach((fn)=>fn());
418
- cleanups.length = 0;
419
- };
420
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(()=>unrefElement(triggerRef), (target)=>{
421
- if (target) {
422
- cleanup();
423
- target.addEventListener('keydown', handleKeydown);
424
- cleanups.push(()=>{
425
- target.removeEventListener('keydown', handleKeydown);
426
- });
427
- }
428
- }, {
429
- immediate: true,
430
- flush: 'post'
431
- });
432
- }
433
- /* ESM default export */ const use_direction_select = useSelectByDirectionEvent;
434
- /**
435
- * [1-10012-1]获取值域列表
436
- * @param data
437
- * @returns
438
- */ const queryDataSetByCodeSystemCodes = (params)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__.dictRequest)('/codeSystem/queryDataSetByCodeSystemCodes', params);
439
- function useFetchDataset(codeSystemCodes, enabledFlag) {
440
- const list = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
441
- async function fetchData() {
442
- if (codeSystemCodes) {
443
- const [, result] = await queryDataSetByCodeSystemCodes({
444
- codeSystemCodes,
445
- enabledFlag: enabledFlag ?? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES
446
- });
447
- if (result) list.value = result.data;
448
- }
449
- }
450
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeMount)(()=>{
451
- fetchData();
452
- });
453
- return list;
454
- }
455
- /* ESM default export */ const use_fetch_dataset = useFetchDataset;
456
- function useFormConfig(options) {
457
- const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
458
- const { getData, dataSetCodes } = options;
459
- const dataSet = useFetchDataset(dataSetCodes);
460
- const data = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>getData(t, dataSet));
461
- return data;
462
- }
463
- function useColumnConfig(options) {
464
- const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
465
- const { getData, dataSetCodes } = options;
466
- const dataSet = useFetchDataset(dataSetCodes);
467
- const data = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>getData(t, dataSet));
468
- return data;
469
- }
470
- export { use_app_config_MAIN_APP_CONFIG as MAIN_APP_CONFIG, use_app_config as useAppConfigData, useColumnConfig, use_direction_select as useDirectionSelect, use_fetch_dataset as useFetchDataset, useFormConfig, use_request as useRequest };
@@ -1,29 +0,0 @@
1
- import { AppConfigType } from './types';
2
- /**
3
- * 获取主应用配置信息
4
- */
5
- export declare enum MAIN_APP_CONFIG {
6
- /**
7
- * 当前激活菜单ID
8
- */
9
- MENU_ID = "menuId",
10
- /**
11
- * 当前账号医院列表
12
- */
13
- HOSPITAL_LIST = "hospitalList",
14
- /**
15
- * 当前账号组织信息
16
- */
17
- CURRENT_ORG = "currentOrg",
18
- /**
19
- * 是否是云环境
20
- */
21
- IS_CLOUD_ENV = "isCloudEnv",
22
- /**
23
- * 是否为 sass 模式
24
- */
25
- IS_SASS_MODE = "isSassMode"
26
- }
27
- declare function useAppConfigData<T extends keyof AppConfigType>(name: T): AppConfigType[T] | undefined;
28
- declare function useAppConfigData<T extends keyof AppConfigType>(name: T[]): Partial<AppConfigType>;
29
- export default useAppConfigData;
@@ -1,33 +0,0 @@
1
- export interface OrgItem {
2
- groupId?: string;
3
- orgId: string;
4
- orgLocationId: string;
5
- orgName: string;
6
- orgTypeCode: string;
7
- orgTypeDesc: string;
8
- tenantId: string;
9
- userXOrgLocationId: string;
10
- }
11
- export interface HospitalItem extends OrgItem {
12
- locationList: OrgItem[];
13
- }
14
- export interface AppConfigType {
15
- /**
16
- * 系统菜单ID
17
- */
18
- menuId: string;
19
- /**
20
- * 是否为云环境
21
- */
22
- isCloudEnv: boolean;
23
- /** 是否为sass模式 */
24
- isSassMode: boolean;
25
- /**
26
- * 当前组织信息
27
- */
28
- currentOrg: OrgItem;
29
- /**
30
- * 医院列表
31
- */
32
- hospitalList: HospitalItem[];
33
- }
@@ -1,15 +0,0 @@
1
- import { Ref } from 'vue';
2
- import { TFunction } from 'i18next';
3
- import { CodeSystem } from '../use-fetch-dataset/types';
4
- import { FormDescItem } from '@/components/pro-form/typings/index';
5
- import { ColumnProps } from '@/components/pro-table/interface';
6
- export interface ConfigOptions<T extends readonly string[] | undefined, U, R = undefined> {
7
- getData: (t: TFunction, data: Ref<(T extends readonly string[] ? {
8
- [P in T[number]]: CodeSystem[];
9
- } : undefined) | undefined> | undefined) => R extends readonly string[] ? {
10
- [P in R[number]]: U[];
11
- } : U[] | [];
12
- dataSetCodes?: T;
13
- }
14
- export declare function useFormConfig<T extends readonly string[] | undefined, R = undefined>(options: ConfigOptions<T, FormDescItem, R>): import("vue").ComputedRef<R extends readonly string[] ? { [P in R[number]]: FormDescItem[]; } : [] | FormDescItem[]>;
15
- export declare function useColumnConfig<T extends readonly string[] | undefined>(options: ConfigOptions<T, ColumnProps>): import("vue").ComputedRef<[] | ColumnProps<any>[]>;
@@ -1,63 +0,0 @@
1
- import { ShallowRef, Ref, WritableComputedRef, ComputedRef, ComponentPublicInstance } from 'vue';
2
- export declare enum KEY_CODE {
3
- /**
4
- * ENTER
5
- */
6
- ENTER = "Enter",
7
- /**
8
- * ESC
9
- */
10
- ESC = "Esc",
11
- /**
12
- * 左
13
- */
14
- LEFT = "ArrowLeft",
15
- /**
16
- * 上
17
- */
18
- UP = "ArrowUp",
19
- /**
20
- * 右
21
- */
22
- RIGHT = "ArrowRight",
23
- /**
24
- * 下
25
- */
26
- DOWN = "ArrowDown"
27
- }
28
- export type MaybeElement = HTMLElement | ComponentPublicInstance | undefined | null;
29
- export type MaybeRef<T = any> = T | Ref<T> | ShallowRef<T> | WritableComputedRef<T>;
30
- export type MaybeElementRef<T extends MaybeElement = MaybeElement> = MaybeRef<T>;
31
- /**
32
- * Maybe it's a ref, or a plain value, or a getter function.
33
- */
34
- export type MaybeRefOrGetter<T = any> = MaybeRef<T> | ComputedRef<T> | (() => T);
35
- export type UnRefElementReturn<T extends MaybeElement = MaybeElement> = T extends ComponentPublicInstance ? Exclude<MaybeElement, ComponentPublicInstance> : T | undefined;
36
- export declare function unrefElement<T extends MaybeElement>(elRef: MaybeRefOrGetter<T>): UnRefElementReturn<T>;
37
- export declare function findActiveIndexByDirection<T extends Record<string, any>>(options: {
38
- data: T[];
39
- activeItem?: T;
40
- rowKey: keyof T | Ref<keyof T>;
41
- direction: string;
42
- containerElement?: HTMLElement;
43
- scrollHeight?: number;
44
- column?: number;
45
- scrollTo?: (index: number) => void;
46
- }): number;
47
- export interface UseSelectByDirectionEventOptions<T> {
48
- triggerRef: MaybeElementRef;
49
- data: MaybeRef<T[] | undefined>;
50
- activeItem: MaybeRef<T | undefined>;
51
- rowKey: string | Ref<string>;
52
- column?: number;
53
- rowHeight?: number;
54
- setCurrentItem: (item: T) => void;
55
- enter?: (e: KeyboardEvent) => void;
56
- scrollTo: (params: {
57
- left: number;
58
- top: number;
59
- behavior: 'smooth' | 'auto';
60
- }) => void;
61
- }
62
- export declare function useSelectByDirectionEvent<U extends Record<string, any>>(options: UseSelectByDirectionEventOptions<U>): void;
63
- export default useSelectByDirectionEvent;
@@ -1,12 +0,0 @@
1
- import type { CodeSystem } from './types.d';
2
- /**
3
- * [1-10012-1]获取值域列表
4
- * @param data
5
- * @returns
6
- */
7
- export declare const queryDataSetByCodeSystemCodes: <T extends readonly string[]>(params: {
8
- codeSystemCodes: readonly string[];
9
- enabledFlag?: number;
10
- }) => Promise<[import("@sun-toolkit/request").SunApiResultData<null> | undefined, import("@sun-toolkit/request").SunApiResultData<{ [P in T[number]]: CodeSystem[]; }> | undefined]>;
11
- export declare function useFetchDataset<T extends readonly string[] | undefined>(codeSystemCodes?: T, enabledFlag?: number): import("vue").Ref<(T extends readonly string[] ? { [P in T[number]]: CodeSystem[]; } : undefined) | undefined, (T extends readonly string[] ? { [P in T[number]]: CodeSystem[]; } : undefined) | undefined>;
12
- export default useFetchDataset;
@@ -1,41 +0,0 @@
1
- import { Ref } from 'vue';
2
- import { UseRequestFetchState, UseRequestOptions, UseRequestPluginReturn, UseRequestService, UseRequestOptionsWithFormatResult, UseRequestOptionsWithInitialData } from './types';
3
- export default class Fetch<TData, TParams extends unknown[] = any> {
4
- serviceRef: Ref<UseRequestService<TData, TParams>>;
5
- options: Partial<UseRequestOptions<TData, TParams, any> & UseRequestOptionsWithFormatResult<TData, TParams, any, any> & UseRequestOptionsWithInitialData<TData, TParams, any>>;
6
- setUpdateData: (currentState: unknown, key?: keyof UseRequestFetchState<TData, TParams>) => void;
7
- initState: Partial<UseRequestFetchState<TData, TParams>>;
8
- pluginImpls: UseRequestPluginReturn<TData, TParams>[] | undefined;
9
- count: number;
10
- state: UseRequestFetchState<TData, TParams>;
11
- previousValidData: UseRequestFetchState<TData, TParams>['data'];
12
- constructor(serviceRef: Ref<UseRequestService<TData, TParams>>, options: Partial<UseRequestOptions<TData, TParams, any> & UseRequestOptionsWithFormatResult<TData, TParams, any, any> & UseRequestOptionsWithInitialData<TData, TParams, any>>, setUpdateData: (currentState: unknown, key?: keyof UseRequestFetchState<TData, TParams>) => void, initState?: Partial<UseRequestFetchState<TData, TParams>>);
13
- /**
14
- * set state
15
- * @param currentState currentState
16
- */
17
- setState(currentState?: Partial<UseRequestFetchState<TData, TParams>>): void;
18
- /**
19
- * should rename
20
- * @param data Result value `unknown`
21
- * @param key Result key `data`| `params` | `loading`| `error`
22
- */
23
- setData(data: unknown, key?: keyof UseRequestFetchState<TData, TParams> | (keyof UseRequestFetchState<TData, TParams>)[]): void;
24
- /**
25
- *
26
- * @param data Result value `unknown`
27
- * @param key Result key `data`| `params` | `loading`| `error`
28
- */
29
- setFetchState(data: unknown, key?: keyof UseRequestFetchState<TData, TParams> | (keyof UseRequestFetchState<TData, TParams>)[]): void;
30
- /**
31
- * Traverse the plugin that needs to be run,
32
- * which is a callback function for the plugin to obtain fetch instances and execute plugin logic at the corresponding nodes.
33
- */
34
- runPluginHandler(event: keyof UseRequestPluginReturn<TData, TParams>, ...rest: unknown[]): any;
35
- runAsync(...params: TParams): Promise<TData>;
36
- run(...params: TParams): void;
37
- cancel(): void;
38
- refresh(): void;
39
- refreshAsync(): Promise<TData>;
40
- mutate(data?: TData | ((oldData?: TData) => TData | undefined)): void;
41
- }
@@ -1,6 +0,0 @@
1
- import type { InjectionKey } from 'vue';
2
- import type { UseRequestOptions } from './types';
3
- export declare const USEREQUEST_GLOBAL_OPTIONS_PROVIDE_KEY: InjectionKey<string>;
4
- export declare const setGlobalOptions: (config: UseRequestOptions<unknown, any, []>) => void;
5
- export declare const getGlobalOptions: () => Record<string, any>;
6
- export declare const clearGlobalOptions: () => void;
@@ -1,5 +0,0 @@
1
- import useRequest from './useRequest';
2
- import useRequestProvider from './useRequestProvider';
3
- import { clearCache as clearUseRequestCache } from './utils/cache';
4
- export { clearUseRequestCache, useRequestProvider };
5
- export default useRequest;