sun-biz 0.0.3-beta.30 → 0.0.3-beta.32
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/dist/components/index.js +17 -6
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +71 -1
- package/dist/hooks/use-data-change-detector/index.d.ts +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +85 -7
- package/package.json +13 -11
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__ from "@sun-toolkit/en
|
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__ from "@sun-toolkit/shared";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_micro_app__ from "@sun-toolkit/micro-app";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next_vue__ from "i18next-vue";
|
|
10
|
+
import "vue-router";
|
|
10
11
|
import * as __WEBPACK_EXTERNAL_MODULE_js_pinyin__ from "js-pinyin";
|
|
11
12
|
var __webpack_modules__ = {
|
|
12
13
|
"./node_modules/.pnpm/vue-loader@17.4.2_vue@3.5.13_typescript@5.7.3__webpack@5.98.0_esbuild@0.24.2_/node_modules/vue-loader/dist/exportHelper.js": function(__unused_webpack_module, exports) {
|
|
@@ -1446,14 +1447,16 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
|
|
|
1446
1447
|
let findObj = serverColum.find((i)=>i.prop === item.prop);
|
|
1447
1448
|
return {
|
|
1448
1449
|
...item,
|
|
1449
|
-
...findObj || {}
|
|
1450
|
+
...findObj || {},
|
|
1451
|
+
sortable: item.sortable
|
|
1450
1452
|
};
|
|
1451
1453
|
});
|
|
1452
1454
|
sourceData.value.sort((a, b)=>a.sort - b.sort);
|
|
1453
1455
|
});
|
|
1454
1456
|
const tableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>sourceData.value.map((item)=>({
|
|
1455
1457
|
...item,
|
|
1456
|
-
isHidden: item.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO
|
|
1458
|
+
isHidden: item.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO,
|
|
1459
|
+
render: ()=>'--'
|
|
1457
1460
|
})));
|
|
1458
1461
|
function changeSourceData(data) {
|
|
1459
1462
|
sourceData.value = data;
|
|
@@ -1797,7 +1800,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
|
|
|
1797
1800
|
const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
|
|
1798
1801
|
[
|
|
1799
1802
|
'__scopeId',
|
|
1800
|
-
"data-v-
|
|
1803
|
+
"data-v-135bc3fe"
|
|
1801
1804
|
]
|
|
1802
1805
|
]);
|
|
1803
1806
|
/* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
|
|
@@ -2274,7 +2277,7 @@ const SELECTION = 'selection';
|
|
|
2274
2277
|
},
|
|
2275
2278
|
isShowDragTips: {
|
|
2276
2279
|
type: Boolean,
|
|
2277
|
-
default:
|
|
2280
|
+
default: true
|
|
2278
2281
|
},
|
|
2279
2282
|
dragTipsCustomStyle: {
|
|
2280
2283
|
default: {}
|
|
@@ -2545,7 +2548,8 @@ const SELECTION = 'selection';
|
|
|
2545
2548
|
sort: index + 1,
|
|
2546
2549
|
...findObj,
|
|
2547
2550
|
label: item.label || findObj.label,
|
|
2548
|
-
isHidden: item.isHidden || findObj.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO
|
|
2551
|
+
isHidden: item.isHidden || findObj.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO,
|
|
2552
|
+
sortable: item.sortable
|
|
2549
2553
|
};
|
|
2550
2554
|
});
|
|
2551
2555
|
result.sort((a, b)=>Number(a.sort) - Number(b.sort));
|
|
@@ -2575,6 +2579,13 @@ const SELECTION = 'selection';
|
|
|
2575
2579
|
}
|
|
2576
2580
|
return result.filter((item)=>!item.isHidden && !(props.componentNo && !serveColumns.value?.length && item.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO));
|
|
2577
2581
|
});
|
|
2582
|
+
/**
|
|
2583
|
+
*
|
|
2584
|
+
* 是否展示当前拖拽提示
|
|
2585
|
+
*/ const draggableTips = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
2586
|
+
const isTips = !!props?.draggable && (!!props?.isShowDragTips || false);
|
|
2587
|
+
return isTips;
|
|
2588
|
+
});
|
|
2578
2589
|
function sortChange({ column, order, prop }) {
|
|
2579
2590
|
if (!props.couldSortFieldList?.length) return emit('sort-change', {
|
|
2580
2591
|
column,
|
|
@@ -2602,7 +2613,7 @@ const SELECTION = 'selection';
|
|
|
2602
2613
|
];
|
|
2603
2614
|
}
|
|
2604
2615
|
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1, [
|
|
2605
|
-
|
|
2616
|
+
draggableTips.value ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
|
|
2606
2617
|
key: 0,
|
|
2607
2618
|
style: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle)({
|
|
2608
2619
|
color: '#f7ba2a',
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export type { PreferenceData } from "./use-app-config/index.ts";
|
|
|
4
4
|
export { default as useDirectionSelect } from "./use-direction-select/index.ts";
|
|
5
5
|
export { default as useFetchDataset, queryDataSetByCodeSystemCodes, type CodeSystem } from "./use-fetch-dataset/index.ts";
|
|
6
6
|
export { default as useEditableTable } from './use-editable-table/index.ts';
|
|
7
|
+
export { default as useDataChangeDetector } from './use-data-change-detector/index.ts';
|
|
7
8
|
export { useColumnConfig, useFormConfig, } from "./use-column&form-config/index.ts";
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,7 +2,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
|
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__ from "@sun-toolkit/request";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__ from "@sun-toolkit/enums";
|
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__ from "@sun-toolkit/shared";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_element_sun__ from "element-sun";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next_vue__ from "i18next-vue";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vue_router__ from "vue-router";
|
|
6
8
|
/* eslint-disable @typescript-eslint/no-explicit-any */ // support refreshDeps & ready
|
|
7
9
|
const useAutoRunPlugin = (fetchInstance, { manual, ready = true, refreshDeps = [], refreshDepsAction })=>{
|
|
8
10
|
const hasAutoRun = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
|
|
@@ -573,6 +575,74 @@ function useFetchDataset(codeSystemCodes, enabledFlag) {
|
|
|
573
575
|
};
|
|
574
576
|
}
|
|
575
577
|
/* ESM default export */ const use_editable_table = useEditableTable;
|
|
578
|
+
function useDataChangeDetector(sources, options) {
|
|
579
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
|
|
580
|
+
const confirmMessage = options?.confirmMessage || '您有未保存的更改,确定要离开吗?';
|
|
581
|
+
// 缓存原始数据
|
|
582
|
+
const cacheSources = sources.map((s)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(s)));
|
|
583
|
+
let clearSourceWatchList = [];
|
|
584
|
+
const checkChange = ()=>!!sources.find((value, index)=>!(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isEqual)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value), cacheSources[index])) || false;
|
|
585
|
+
const clearSourceWatch = ()=>{
|
|
586
|
+
if (clearSourceWatchList.length) {
|
|
587
|
+
clearSourceWatchList.forEach((clearWatch)=>{
|
|
588
|
+
clearWatch();
|
|
589
|
+
});
|
|
590
|
+
clearSourceWatchList = [];
|
|
591
|
+
}
|
|
592
|
+
};
|
|
593
|
+
const watchSources = ()=>{
|
|
594
|
+
clearSourceWatch();
|
|
595
|
+
sources.forEach((value, index)=>{
|
|
596
|
+
clearSourceWatchList.push((0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(value, (val, oldVal)=>{
|
|
597
|
+
console.log(value, oldVal, (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(val), 'tst');
|
|
598
|
+
const raw = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(val));
|
|
599
|
+
cacheSources[index] = raw;
|
|
600
|
+
}, {
|
|
601
|
+
once: true
|
|
602
|
+
}));
|
|
603
|
+
});
|
|
604
|
+
};
|
|
605
|
+
watchSources();
|
|
606
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount)(()=>{
|
|
607
|
+
clearSourceWatch();
|
|
608
|
+
});
|
|
609
|
+
// 路由拦截
|
|
610
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue_router__.onBeforeRouteLeave)((_, from, next)=>{
|
|
611
|
+
if (options?.isSkip?.value) return next();
|
|
612
|
+
if (checkChange()) {
|
|
613
|
+
sources.forEach((value, index)=>{
|
|
614
|
+
console.log(index, (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value), cacheSources[index]);
|
|
615
|
+
});
|
|
616
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessageBox.confirm(confirmMessage, t('global:tip'), {
|
|
617
|
+
confirmButtonText: t('global:confirm'),
|
|
618
|
+
cancelButtonText: t('global:cancel'),
|
|
619
|
+
type: 'warning'
|
|
620
|
+
}).then(async ()=>{
|
|
621
|
+
next();
|
|
622
|
+
}).catch(()=>{
|
|
623
|
+
next(false);
|
|
624
|
+
});
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
627
|
+
next();
|
|
628
|
+
});
|
|
629
|
+
// 手动更新原始数据
|
|
630
|
+
function cacheOriginSources() {
|
|
631
|
+
sources.forEach((value, index)=>{
|
|
632
|
+
const raw = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value));
|
|
633
|
+
cacheSources[index] = raw;
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
checkChange,
|
|
638
|
+
updateOriginals: cacheOriginSources,
|
|
639
|
+
resetDetector: ()=>{
|
|
640
|
+
cacheOriginSources();
|
|
641
|
+
watchSources();
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
/* ESM default export */ const use_data_change_detector = useDataChangeDetector;
|
|
576
646
|
function useFormConfig(options) {
|
|
577
647
|
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
|
|
578
648
|
const { getData, dataSetCodes } = options;
|
|
@@ -587,4 +657,4 @@ function useColumnConfig(options) {
|
|
|
587
657
|
const data = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>getData(t, dataSet));
|
|
588
658
|
return data;
|
|
589
659
|
}
|
|
590
|
-
export { use_app_config_MAIN_APP_CONFIG as MAIN_APP_CONFIG, queryDataSetByCodeSystemCodes, use_app_config as useAppConfigData, useColumnConfig, use_direction_select as useDirectionSelect, use_editable_table as useEditableTable, use_fetch_dataset as useFetchDataset, useFormConfig, use_request as useRequest };
|
|
660
|
+
export { use_app_config_MAIN_APP_CONFIG as MAIN_APP_CONFIG, queryDataSetByCodeSystemCodes, use_app_config as useAppConfigData, useColumnConfig, use_data_change_detector as useDataChangeDetector, use_direction_select as useDirectionSelect, use_editable_table as useEditableTable, use_fetch_dataset as useFetchDataset, useFormConfig, use_request as useRequest };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare function useDataChangeDetector<T extends readonly unknown[]>(sources: {
|
|
3
|
+
[K in keyof T]: Ref<T[K]>;
|
|
4
|
+
}, options?: {
|
|
5
|
+
confirmMessage?: string;
|
|
6
|
+
isSkip?: Ref<boolean>;
|
|
7
|
+
}): {
|
|
8
|
+
checkChange: () => boolean;
|
|
9
|
+
updateOriginals: () => void;
|
|
10
|
+
resetDetector: () => void;
|
|
11
|
+
};
|
|
12
|
+
export default useDataChangeDetector;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export { default as useFetchDataset, queryDataSetByCodeSystemCodes, type CodeSys
|
|
|
21
21
|
export { useEditableTable } from './hooks/use-editable-table';
|
|
22
22
|
export type { TableRef } from './hooks/use-editable-table';
|
|
23
23
|
export { useColumnConfig, useFormConfig } from './hooks/use-column&form-config';
|
|
24
|
+
export { useDataChangeDetector } from './hooks/use-data-change-detector';
|
|
24
25
|
export { debounce, isNumber, decimalCount, formatDecimalNumber } from './utils';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_request__ from "@sun-toolkit/
|
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__ from "@sun-toolkit/shared";
|
|
8
8
|
import * as __WEBPACK_EXTERNAL_MODULE__sun_toolkit_micro_app__ from "@sun-toolkit/micro-app";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE_i18next_vue__ from "i18next-vue";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_vue_router__ from "vue-router";
|
|
10
11
|
import * as __WEBPACK_EXTERNAL_MODULE_js_pinyin__ from "js-pinyin";
|
|
11
12
|
var __webpack_modules__ = {
|
|
12
13
|
"./node_modules/.pnpm/vue-loader@17.4.2_vue@3.5.13_typescript@5.7.3__webpack@5.98.0_esbuild@0.24.2_/node_modules/vue-loader/dist/exportHelper.js": function(__unused_webpack_module, exports) {
|
|
@@ -1447,14 +1448,16 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
|
|
|
1447
1448
|
let findObj = serverColum.find((i)=>i.prop === item.prop);
|
|
1448
1449
|
return {
|
|
1449
1450
|
...item,
|
|
1450
|
-
...findObj || {}
|
|
1451
|
+
...findObj || {},
|
|
1452
|
+
sortable: item.sortable
|
|
1451
1453
|
};
|
|
1452
1454
|
});
|
|
1453
1455
|
sourceData.value.sort((a, b)=>a.sort - b.sort);
|
|
1454
1456
|
});
|
|
1455
1457
|
const tableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>sourceData.value.map((item)=>({
|
|
1456
1458
|
...item,
|
|
1457
|
-
isHidden: item.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO
|
|
1459
|
+
isHidden: item.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO,
|
|
1460
|
+
render: ()=>'--'
|
|
1458
1461
|
})));
|
|
1459
1462
|
function changeSourceData(data) {
|
|
1460
1463
|
sourceData.value = data;
|
|
@@ -1798,7 +1801,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
|
|
|
1798
1801
|
const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
|
|
1799
1802
|
[
|
|
1800
1803
|
'__scopeId',
|
|
1801
|
-
"data-v-
|
|
1804
|
+
"data-v-135bc3fe"
|
|
1802
1805
|
]
|
|
1803
1806
|
]);
|
|
1804
1807
|
/* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
|
|
@@ -2275,7 +2278,7 @@ const SELECTION = 'selection';
|
|
|
2275
2278
|
},
|
|
2276
2279
|
isShowDragTips: {
|
|
2277
2280
|
type: Boolean,
|
|
2278
|
-
default:
|
|
2281
|
+
default: true
|
|
2279
2282
|
},
|
|
2280
2283
|
dragTipsCustomStyle: {
|
|
2281
2284
|
default: {}
|
|
@@ -2546,7 +2549,8 @@ const SELECTION = 'selection';
|
|
|
2546
2549
|
sort: index + 1,
|
|
2547
2550
|
...findObj,
|
|
2548
2551
|
label: item.label || findObj.label,
|
|
2549
|
-
isHidden: item.isHidden || findObj.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO
|
|
2552
|
+
isHidden: item.isHidden || findObj.displayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO,
|
|
2553
|
+
sortable: item.sortable
|
|
2550
2554
|
};
|
|
2551
2555
|
});
|
|
2552
2556
|
result.sort((a, b)=>Number(a.sort) - Number(b.sort));
|
|
@@ -2576,6 +2580,13 @@ const SELECTION = 'selection';
|
|
|
2576
2580
|
}
|
|
2577
2581
|
return result.filter((item)=>!item.isHidden && !(props.componentNo && !serveColumns.value?.length && item.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO));
|
|
2578
2582
|
});
|
|
2583
|
+
/**
|
|
2584
|
+
*
|
|
2585
|
+
* 是否展示当前拖拽提示
|
|
2586
|
+
*/ const draggableTips = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
|
|
2587
|
+
const isTips = !!props?.draggable && (!!props?.isShowDragTips || false);
|
|
2588
|
+
return isTips;
|
|
2589
|
+
});
|
|
2579
2590
|
function sortChange({ column, order, prop }) {
|
|
2580
2591
|
if (!props.couldSortFieldList?.length) return emit('sort-change', {
|
|
2581
2592
|
column,
|
|
@@ -2603,7 +2614,7 @@ const SELECTION = 'selection';
|
|
|
2603
2614
|
];
|
|
2604
2615
|
}
|
|
2605
2616
|
return (_ctx, _cache)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1, [
|
|
2606
|
-
|
|
2617
|
+
draggableTips.value ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
|
|
2607
2618
|
key: 0,
|
|
2608
2619
|
style: (0, __WEBPACK_EXTERNAL_MODULE_vue__.normalizeStyle)({
|
|
2609
2620
|
color: '#f7ba2a',
|
|
@@ -3834,6 +3845,73 @@ function useSelectByDirectionEvent(options) {
|
|
|
3834
3845
|
validateItem
|
|
3835
3846
|
};
|
|
3836
3847
|
}
|
|
3848
|
+
function useDataChangeDetector(sources, options) {
|
|
3849
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
|
|
3850
|
+
const confirmMessage = options?.confirmMessage || '您有未保存的更改,确定要离开吗?';
|
|
3851
|
+
// 缓存原始数据
|
|
3852
|
+
const cacheSources = sources.map((s)=>(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(s)));
|
|
3853
|
+
let clearSourceWatchList = [];
|
|
3854
|
+
const checkChange = ()=>!!sources.find((value, index)=>!(0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.isEqual)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value), cacheSources[index])) || false;
|
|
3855
|
+
const clearSourceWatch = ()=>{
|
|
3856
|
+
if (clearSourceWatchList.length) {
|
|
3857
|
+
clearSourceWatchList.forEach((clearWatch)=>{
|
|
3858
|
+
clearWatch();
|
|
3859
|
+
});
|
|
3860
|
+
clearSourceWatchList = [];
|
|
3861
|
+
}
|
|
3862
|
+
};
|
|
3863
|
+
const watchSources = ()=>{
|
|
3864
|
+
clearSourceWatch();
|
|
3865
|
+
sources.forEach((value, index)=>{
|
|
3866
|
+
clearSourceWatchList.push((0, __WEBPACK_EXTERNAL_MODULE_vue__.watch)(value, (val, oldVal)=>{
|
|
3867
|
+
console.log(value, oldVal, (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(val), 'tst');
|
|
3868
|
+
const raw = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(val));
|
|
3869
|
+
cacheSources[index] = raw;
|
|
3870
|
+
}, {
|
|
3871
|
+
once: true
|
|
3872
|
+
}));
|
|
3873
|
+
});
|
|
3874
|
+
};
|
|
3875
|
+
watchSources();
|
|
3876
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue__.onBeforeUnmount)(()=>{
|
|
3877
|
+
clearSourceWatch();
|
|
3878
|
+
});
|
|
3879
|
+
// 路由拦截
|
|
3880
|
+
(0, __WEBPACK_EXTERNAL_MODULE_vue_router__.onBeforeRouteLeave)((_, from, next)=>{
|
|
3881
|
+
if (options?.isSkip?.value) return next();
|
|
3882
|
+
if (checkChange()) {
|
|
3883
|
+
sources.forEach((value, index)=>{
|
|
3884
|
+
console.log(index, (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value), cacheSources[index]);
|
|
3885
|
+
});
|
|
3886
|
+
__WEBPACK_EXTERNAL_MODULE_element_sun__.ElMessageBox.confirm(confirmMessage, t('global:tip'), {
|
|
3887
|
+
confirmButtonText: t('global:confirm'),
|
|
3888
|
+
cancelButtonText: t('global:cancel'),
|
|
3889
|
+
type: 'warning'
|
|
3890
|
+
}).then(async ()=>{
|
|
3891
|
+
next();
|
|
3892
|
+
}).catch(()=>{
|
|
3893
|
+
next(false);
|
|
3894
|
+
});
|
|
3895
|
+
return;
|
|
3896
|
+
}
|
|
3897
|
+
next();
|
|
3898
|
+
});
|
|
3899
|
+
// 手动更新原始数据
|
|
3900
|
+
function cacheOriginSources() {
|
|
3901
|
+
sources.forEach((value, index)=>{
|
|
3902
|
+
const raw = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.cloneDeep)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(value));
|
|
3903
|
+
cacheSources[index] = raw;
|
|
3904
|
+
});
|
|
3905
|
+
}
|
|
3906
|
+
return {
|
|
3907
|
+
checkChange,
|
|
3908
|
+
updateOriginals: cacheOriginSources,
|
|
3909
|
+
resetDetector: ()=>{
|
|
3910
|
+
cacheOriginSources();
|
|
3911
|
+
watchSources();
|
|
3912
|
+
}
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
3837
3915
|
function useFormConfig(options) {
|
|
3838
3916
|
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_i18next_vue__.useTranslation)();
|
|
3839
3917
|
const { getData, dataSetCodes } = options;
|
|
@@ -8015,4 +8093,4 @@ const form_design_render_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(f
|
|
|
8015
8093
|
]);
|
|
8016
8094
|
/* ESM default export */ const form_design_render = form_design_render_exports_;
|
|
8017
8095
|
/** components **/ /** hooks ** */ var __webpack_exports__COMPONENT_CODE = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.COMPONENT_CODE;
|
|
8018
|
-
export { access_info as AccessInfo, BANNER_COMPONENT_CONFIG, BannerInfo, copy_text_with_tooltip as CopyTextWithTooltip, constant_DATA_SOURCE_CONTENT_TYPE_CODE as DATA_SOURCE_CONTENT_TYPE_CODE, dbgrid_component_setting as DbgridComponentSetting, dict_select as DictSelect, dml_button as DmlButton, flag_select as FlagSelect, form_design_render as FormDesignRender, FormUnit, hospital_select as HospitalSelect, use_app_config_MAIN_APP_CONFIG as MAIN_APP_CONFIG, patient_access as PatientAccess, PatientInfo, printReceiptBtn as PrintReceiptBtn, pro_dialog as ProDialog, pro_form as ProForm, invoice as ProInvoice, pro_table as ProTable, pro_table_v2 as ProTableV2, Title, convertToSpellNo, convertToWbNo, debounce, decimalCount, formatDecimalNumber, isNumber, print, queryDataSetByCodeSystemCodes, use_app_config as useAppConfigData, useColumnConfig, use_direction_select as useDirectionSelect, useEditableTable, use_fetch_dataset as useFetchDataset, useFormConfig, usePrintReceipt, use_request as useRequest, __webpack_exports__COMPONENT_CODE as COMPONENT_CODE };
|
|
8096
|
+
export { access_info as AccessInfo, BANNER_COMPONENT_CONFIG, BannerInfo, copy_text_with_tooltip as CopyTextWithTooltip, constant_DATA_SOURCE_CONTENT_TYPE_CODE as DATA_SOURCE_CONTENT_TYPE_CODE, dbgrid_component_setting as DbgridComponentSetting, dict_select as DictSelect, dml_button as DmlButton, flag_select as FlagSelect, form_design_render as FormDesignRender, FormUnit, hospital_select as HospitalSelect, use_app_config_MAIN_APP_CONFIG as MAIN_APP_CONFIG, patient_access as PatientAccess, PatientInfo, printReceiptBtn as PrintReceiptBtn, pro_dialog as ProDialog, pro_form as ProForm, invoice as ProInvoice, pro_table as ProTable, pro_table_v2 as ProTableV2, Title, convertToSpellNo, convertToWbNo, debounce, decimalCount, formatDecimalNumber, isNumber, print, queryDataSetByCodeSystemCodes, use_app_config as useAppConfigData, useColumnConfig, useDataChangeDetector, use_direction_select as useDirectionSelect, useEditableTable, use_fetch_dataset as useFetchDataset, useFormConfig, usePrintReceipt, use_request as useRequest, __webpack_exports__COMPONENT_CODE as COMPONENT_CODE };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sun-biz",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"src/*",
|
|
@@ -50,33 +50,35 @@
|
|
|
50
50
|
"storybook-addon-rslib": "^0.1.10",
|
|
51
51
|
"storybook-vue3-rsbuild": "0.1.5",
|
|
52
52
|
"tailwindcss": "^3.4.17",
|
|
53
|
-
"typescript": "^5.7.3"
|
|
53
|
+
"typescript": "^5.7.3",
|
|
54
|
+
"vue": "^3.5.13",
|
|
55
|
+
"vue-router": "^4.5.1",
|
|
56
|
+
"element-sun": "0.0.0-dev.4",
|
|
57
|
+
"@sun-toolkit/enums": "1.0.0-beta.12",
|
|
58
|
+
"@sun-toolkit/micro-app": "0.0.1-beta.8",
|
|
59
|
+
"@sun-toolkit/request": "1.0.0-beta.10",
|
|
60
|
+
"@sun-toolkit/shared": "0.0.1-beta.6"
|
|
54
61
|
},
|
|
55
62
|
"peerDependencies": {
|
|
56
63
|
"@element-sun/icons-vue": "*",
|
|
57
64
|
"@sun-toolkit/enums": "*",
|
|
65
|
+
"@sun-toolkit/micro-app": "*",
|
|
58
66
|
"@sun-toolkit/request": "*",
|
|
59
67
|
"@sun-toolkit/shared": "*",
|
|
60
|
-
"@sun-toolkit/micro-app": "*",
|
|
61
68
|
"element-sun": "*",
|
|
62
69
|
"i18next": "*",
|
|
63
70
|
"i18next-vue": "*",
|
|
64
|
-
"vue": "^3.2.0"
|
|
71
|
+
"vue": "^3.2.0",
|
|
72
|
+
"vue-router": "^4.5"
|
|
65
73
|
},
|
|
66
74
|
"dependencies": {
|
|
67
75
|
"@element-sun/icons-vue": "^1.0.6",
|
|
68
|
-
"@sun-toolkit/enums": "1.0.0-beta.12",
|
|
69
|
-
"@sun-toolkit/micro-app": "0.0.1-beta.8",
|
|
70
|
-
"@sun-toolkit/request": "1.0.0-beta.10",
|
|
71
|
-
"@sun-toolkit/shared": "0.0.1-beta.4",
|
|
72
76
|
"axios": "^1.8.1",
|
|
73
|
-
"element-sun": "0.0.0-dev.4",
|
|
74
77
|
"i18next": "^23.16.8",
|
|
75
78
|
"i18next-vue": "^5.2.0",
|
|
76
79
|
"js-pinyin": "^0.2.7",
|
|
77
80
|
"latest": "^0.2.0",
|
|
78
81
|
"lodash": "^4.17.21",
|
|
79
|
-
"sortablejs": "^1.15.6"
|
|
80
|
-
"vue": "^3.5.13"
|
|
82
|
+
"sortablejs": "^1.15.6"
|
|
81
83
|
}
|
|
82
84
|
}
|