sun-biz 0.0.3-beta.26 → 0.0.3-beta.27

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.
@@ -265,8 +265,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
265
265
  * @returns {String}
266
266
  * */ function formatValue(callValue) {
267
267
  // 如果当前值为数组,使用 / 拼接(根据需求自定义)
268
- if (isArray(callValue)) return callValue.length ? callValue.join(" / ") : "--";
269
- return callValue ?? "--";
268
+ if (isArray(callValue)) return callValue.length ? callValue.join(' / ') : '--';
269
+ return callValue ?? '--';
270
270
  }
271
271
  /**
272
272
  * @description 处理 prop 为多级嵌套的情况,返回的数据 (列如: prop: user.name)
@@ -274,8 +274,8 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
274
274
  * @param {String} prop 当前 prop
275
275
  * @returns {*}
276
276
  * */ function handleRowAccordingToProp(row, prop) {
277
- if (!prop?.includes(".")) return row[prop] ?? "--";
278
- prop.split(".").forEach((item)=>row = row[item] ?? "--");
277
+ if (!prop?.includes('.')) return row[prop] ?? '--';
278
+ prop.split('.').forEach((item)=>row = row[item] ?? '--');
279
279
  return row;
280
280
  }
281
281
  /**
@@ -283,7 +283,7 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
283
283
  * @param {String} prop 当前 prop
284
284
  * @returns {String}
285
285
  * */ function handleProp(prop) {
286
- const propArr = prop.split(".");
286
+ const propArr = prop.split('.');
287
287
  if (1 == propArr.length) return prop;
288
288
  return propArr[propArr.length - 1];
289
289
  }
@@ -304,15 +304,54 @@ const copy_text_with_tooltip_exports_ = /*#__PURE__*/ (0, exportHelper["default"
304
304
  * @param {String} type 过滤类型(目前只有 tag)
305
305
  * @returns {String}
306
306
  * */ function filterEnum(callValue, enumData, fieldNames, type) {
307
- const value = fieldNames?.value ?? "value";
308
- const label = fieldNames?.label ?? "label";
309
- const children = fieldNames?.children ?? "children";
307
+ const value = fieldNames?.value ?? 'value';
308
+ const label = fieldNames?.label ?? 'label';
309
+ const children = fieldNames?.children ?? 'children';
310
310
  let filterData = {};
311
311
  // 判断 enumData 是否为数组
312
312
  if (Array.isArray(enumData)) filterData = findItemNested(enumData, callValue, value, children);
313
313
  // 判断是否输出的结果为 tag 类型
314
- if ("tag" == type) return filterData?.tagType ? filterData.tagType : "";
315
- return filterData ? filterData[label] : "--";
314
+ if ('tag' == type) return filterData?.tagType ? filterData.tagType : '';
315
+ return filterData ? filterData[label] : '--';
316
+ }
317
+ const ASCENDING = 'ascending';
318
+ const DESCENDING = 'descending';
319
+ /**
320
+ * 多字段排序(支持字符串、数字、日期)
321
+ * @param data 要排序的数组
322
+ * @param fields 排序字段数组(按优先级从高到低)
323
+ */ function multiFieldSort(data, fields) {
324
+ // 判断是否是日期格式字符串
325
+ function isDateLike(val) {
326
+ return 'string' == typeof val && /^\d{4}[-/]\d{2}[-/]\d{2}/.test(val);
327
+ }
328
+ // 判断 null 或 undefined
329
+ function isNullish(val) {
330
+ return null == val;
331
+ }
332
+ return [
333
+ ...data
334
+ ].sort((a, b)=>{
335
+ for (const { fieldName, ascendFlag, type = 'auto' } of fields){
336
+ const valA = a[fieldName];
337
+ const valB = b[fieldName];
338
+ if (isNullish(valA) && !isNullish(valB)) return ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES ? 1 : -1;
339
+ if (!isNullish(valA) && isNullish(valB)) return ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES ? -1 : 1;
340
+ if (isNullish(valA) && isNullish(valB)) continue;
341
+ let parsedA = valA;
342
+ let parsedB = valB;
343
+ const shouldParseDate = 'date' === type || 'auto' === type && isDateLike(valA) && isDateLike(valB);
344
+ if (shouldParseDate) {
345
+ parsedA = new Date(valA).getTime();
346
+ parsedB = new Date(valB).getTime();
347
+ }
348
+ if ('string' == typeof parsedA && 'string' == typeof parsedB) {
349
+ const cmp = parsedA.toLowerCase().localeCompare(parsedB.toLowerCase());
350
+ if (0 !== cmp) return ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES ? cmp : -cmp;
351
+ } else if (parsedA !== parsedB) return ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES ? parsedA - parsedB : parsedB - parsedA;
352
+ }
353
+ return 0;
354
+ });
316
355
  }
317
356
  function _isSlot(s) {
318
357
  return 'function' == typeof s || '[object Object]' === Object.prototype.toString.call(s) && !(0, __WEBPACK_EXTERNAL_MODULE_vue__.isVNode)(s);
@@ -326,11 +365,13 @@ const TableColumn = (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
326
365
  }
327
366
  },
328
367
  setup (props, { slots }) {
329
- const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('enumMap', (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(new Map())); // 渲染表格数据
368
+ const enumMap = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('enumMap', (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(new Map())); // 注入数据(带默认值)
369
+ const hiddenDefaultText = (0, __WEBPACK_EXTERNAL_MODULE_vue__.inject)('hiddenDefaultText'); // 渲染表格数据
330
370
  const renderCellData = (item, scope)=>{
331
371
  const rawValue = handleRowAccordingToProp(scope.row, item.prop);
332
372
  let result = enumMap.value.get(item.prop) && item.isFilterEnum ? filterEnum(rawValue, enumMap.value.get(item.prop), item.fieldNames) : formatValue(rawValue);
333
373
  if (item?.autoFormatterNumber) result = formatDecimalNumber(result) ?? '--';
374
+ if (hiddenDefaultText && '--' === result) result = ' ';
334
375
  return item?.supportCopyAndTips ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(copy_text_with_tooltip, {
335
376
  supportTextCopy: item?.supportTextCopy,
336
377
  align: "text-center",
@@ -535,7 +576,37 @@ function useTableConfigColumn(changeInputSort, length, disabledDraggable) {
535
576
  {
536
577
  label: '列名称',
537
578
  prop: 'label',
538
- minWidth: 170
579
+ minWidth: 170,
580
+ render: (row)=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("div", {
581
+ class: 'cursor-pointer',
582
+ onClick: (event)=>{
583
+ event.stopPropagation();
584
+ switch(row.ascendFlag){
585
+ case __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES:
586
+ row.ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO;
587
+ break;
588
+ case __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO:
589
+ row.ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL;
590
+ break;
591
+ default:
592
+ row.ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES;
593
+ }
594
+ }
595
+ }, [
596
+ row.label,
597
+ row.sortable && (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("span", {
598
+ class: "caret-wrapper"
599
+ }, [
600
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("i", {
601
+ class: `sort-caret ascending ${row.ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES ? '!border-b-blue-500' : ''}`
602
+ }, null),
603
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)("i", {
604
+ class: `sort-caret descending ${row.ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO ? '!border-t-blue-500' : ''}`
605
+ }, null)
606
+ ])
607
+ ], 8, [
608
+ "onClick"
609
+ ])
539
610
  },
540
611
  {
541
612
  label: '属性',
@@ -667,6 +738,271 @@ const DbgridTableConfig_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(Db
667
738
  ]
668
739
  ]);
669
740
  /* ESM default export */ const DbgridTableConfig = DbgridTableConfig_exports_;
741
+ const _hoisted_1 = {
742
+ key: 0
743
+ };
744
+ const _hoisted_2 = {
745
+ class: "mb-2 flex items-center"
746
+ };
747
+ const _hoisted_3 = {
748
+ class: "flex justify-end",
749
+ style: {
750
+ "justify-content": "end"
751
+ }
752
+ };
753
+ /* ESM default export */ const AdvancedSortvue_type_script_setup_true_lang_tsx = /*@__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent)({
754
+ __name: 'AdvancedSort',
755
+ props: {
756
+ data: {},
757
+ changeSourceData: {
758
+ type: Function
759
+ }
760
+ },
761
+ setup (__props) {
762
+ const props = __props;
763
+ const isSHow = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(false);
764
+ const popoverRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
765
+ function show() {
766
+ isSHow.value = true;
767
+ }
768
+ function hide() {
769
+ isSHow.value = false;
770
+ }
771
+ function confirm() {
772
+ popoverRef.value.hide();
773
+ }
774
+ function deleteCondition(name) {
775
+ let result = [
776
+ ...props.data
777
+ ];
778
+ result = result.map((item)=>{
779
+ if (item.prop === name) return {
780
+ ...item,
781
+ ascendFlag: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL
782
+ };
783
+ return item;
784
+ });
785
+ props.changeSourceData(result);
786
+ }
787
+ function changeInputSort(flag, sort) {
788
+ let data = [
789
+ ...tableData.value
790
+ ];
791
+ let findObj = data.find((item, index)=>index == flag);
792
+ data.splice(flag, 1);
793
+ data.splice(sort - 1, 0, findObj);
794
+ data = data.map((item, index)=>({
795
+ ...item,
796
+ ascendSort: index + 1
797
+ }));
798
+ let result = [
799
+ ...props.data
800
+ ];
801
+ result = result.map((item)=>{
802
+ let findObj = data.find((cur)=>cur.prop === item.prop);
803
+ if (findObj) return {
804
+ ...item,
805
+ ascendSort: findObj.ascendSort
806
+ };
807
+ return {
808
+ ...item
809
+ };
810
+ });
811
+ props.changeSourceData(result);
812
+ }
813
+ const changeSort = (0, __WEBPACK_EXTERNAL_MODULE__sun_toolkit_shared__.debounce)(changeInputSort, 1200);
814
+ function handleSortEnd() {}
815
+ const columns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>getColumn());
816
+ const tableData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
817
+ let result = props.data.filter((item)=>item.sortable);
818
+ result.sort((a, b)=>(a?.ascendSort || 0) - (b?.ascendSort || 0));
819
+ result = result.map((item, index)=>{
820
+ item.ascendSort = index + 1;
821
+ return item;
822
+ });
823
+ return result;
824
+ });
825
+ function changeAscendFlag(name, value, ascendSort) {
826
+ let result = [
827
+ ...props.data
828
+ ];
829
+ result = result.map((item)=>{
830
+ if (item.prop === name) return {
831
+ ...item,
832
+ ascendFlag: value,
833
+ ascendSort
834
+ };
835
+ return item;
836
+ });
837
+ props.changeSourceData(result);
838
+ }
839
+ function getColumn() {
840
+ return [
841
+ {
842
+ label: '名称',
843
+ prop: 'label',
844
+ minWidth: 170
845
+ },
846
+ {
847
+ label: '排序规则',
848
+ prop: 'ascendFlag',
849
+ minWidth: 170,
850
+ editable: true,
851
+ render: (row)=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElRadioGroup, {
852
+ size: 'small',
853
+ modelValue: row.ascendFlag,
854
+ 'onUpdate:modelValue': (value)=>{
855
+ changeAscendFlag(row.prop, value, row.ascendSort);
856
+ }
857
+ }, ()=>[
858
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElRadioButton, {
859
+ label: '正序',
860
+ value: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES
861
+ }),
862
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElRadioButton, {
863
+ label: '倒序',
864
+ value: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO
865
+ }),
866
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElRadioButton, {
867
+ label: '不排序',
868
+ value: __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL
869
+ })
870
+ ])
871
+ },
872
+ {
873
+ label: '优先级',
874
+ prop: 'displayFlag',
875
+ minWidth: 170,
876
+ editable: true,
877
+ render: (row, index)=>(0, __WEBPACK_EXTERNAL_MODULE_vue__.h)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElInputNumber, {
878
+ controls: false,
879
+ placeholder: '请输入优先级',
880
+ min: 1,
881
+ max: tableData.value.length,
882
+ modelValue: row.ascendSort,
883
+ 'onUpdate:modelValue': (value)=>{
884
+ row.ascendSort = value;
885
+ changeSort(index, value);
886
+ },
887
+ onInput: (value)=>{
888
+ changeSort(index, value);
889
+ }
890
+ })
891
+ }
892
+ ];
893
+ }
894
+ return (_ctx, _cache)=>{
895
+ const _component_CaretTop = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("CaretTop");
896
+ const _component_el_icon = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-icon");
897
+ const _component_CaretBottom = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("CaretBottom");
898
+ const _component_el_tag = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-tag");
899
+ const _component_el_button = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-button");
900
+ const _component_el_popover = (0, __WEBPACK_EXTERNAL_MODULE_vue__.resolveComponent)("el-popover");
901
+ return (0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_popover, {
902
+ trigger: "click",
903
+ width: "600",
904
+ ref_key: "popoverRef",
905
+ ref: popoverRef,
906
+ onShow: show,
907
+ onHide: hide,
908
+ icon: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__element_sun_icons_vue__.InfoFilled),
909
+ "icon-color": "#626AEF"
910
+ }, {
911
+ reference: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
912
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_button, null, {
913
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
914
+ _cache[0] || (_cache[0] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("组合排序 ")),
915
+ isSHow.value ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true) : ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("span", _hoisted_1, [
916
+ ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(true), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)(__WEBPACK_EXTERNAL_MODULE_vue__.Fragment, null, (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderList)(tableData.value.filter((item)=>item?.ascendFlag === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG).NO || item?.ascendFlag === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG).YES), (item)=>((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_tag, {
917
+ hit: false,
918
+ key: item.prop,
919
+ class: "ml-2",
920
+ effect: "plain",
921
+ onClose: ()=>{
922
+ deleteCondition(item.prop);
923
+ },
924
+ closable: "",
925
+ type: "info"
926
+ }, {
927
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
928
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.toDisplayString)(item.label) + " ", 1),
929
+ item?.ascendFlag === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG).YES ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_icon, {
930
+ key: 0,
931
+ class: "text-blue-500"
932
+ }, {
933
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
934
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_CaretTop)
935
+ ]),
936
+ _: 1
937
+ })) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
938
+ item?.ascendFlag === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG).NO ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(_component_el_icon, {
939
+ key: 1,
940
+ class: "text-blue-500"
941
+ }, {
942
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
943
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_CaretBottom)
944
+ ]),
945
+ _: 1
946
+ })) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
947
+ ]),
948
+ _: 2
949
+ }, 1032, [
950
+ "onClose"
951
+ ]))), 128))
952
+ ]))
953
+ ]),
954
+ _: 1
955
+ })
956
+ ]),
957
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
958
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_2, [
959
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_icon, {
960
+ style: {
961
+ color: "#0000ffa6"
962
+ },
963
+ class: "mr-2"
964
+ }, {
965
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
966
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__element_sun_icons_vue__.InfoFilled))
967
+ ]),
968
+ _: 1
969
+ }),
970
+ _cache[1] || (_cache[1] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)("请根据以下规则编辑排序条件 "))
971
+ ]),
972
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(pro_table, {
973
+ onDragEnd: handleSortEnd,
974
+ ref: "tableRef",
975
+ "drag-tips": "",
976
+ class: "mb-2",
977
+ draggable: true,
978
+ "row-key": "prop",
979
+ columns: columns.value,
980
+ data: tableData.value
981
+ }, null, 8, [
982
+ "columns",
983
+ "data"
984
+ ]),
985
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_3, [
986
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(_component_el_button, {
987
+ size: "small",
988
+ onClick: confirm
989
+ }, {
990
+ default: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>_cache[2] || (_cache[2] = [
991
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createTextVNode)(" 关闭 ")
992
+ ])),
993
+ _: 1
994
+ })
995
+ ])
996
+ ]),
997
+ _: 1
998
+ }, 8, [
999
+ "icon"
1000
+ ]);
1001
+ };
1002
+ }
1003
+ });
1004
+ const AdvancedSort_exports_ = AdvancedSortvue_type_script_setup_true_lang_tsx;
1005
+ /* ESM default export */ const AdvancedSort = AdvancedSort_exports_;
670
1006
  /**
671
1007
  * 获取主应用配置信息
672
1008
  */ var use_app_config_MAIN_APP_CONFIG = /*#__PURE__*/ function(MAIN_APP_CONFIG) {
@@ -735,10 +1071,10 @@ function useDialog(initialVisible = false) {
735
1071
  closeLoading
736
1072
  };
737
1073
  }
738
- const _hoisted_1 = {
1074
+ const pro_dialogvue_type_script_setup_true_lang_ts_name_ProDialog_hoisted_1 = {
739
1075
  class: "flex w-full items-center justify-between"
740
1076
  };
741
- const _hoisted_2 = {
1077
+ const pro_dialogvue_type_script_setup_true_lang_ts_name_ProDialog_hoisted_2 = {
742
1078
  key: 0,
743
1079
  class: "dialog-footer"
744
1080
  };
@@ -843,7 +1179,7 @@ const _hoisted_2 = {
843
1179
  onClose: justCloseDialog
844
1180
  }), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createSlots)({
845
1181
  header: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(({ titleClass })=>[
846
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_1, [
1182
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", pro_dialogvue_type_script_setup_true_lang_ts_name_ProDialog_hoisted_1, [
847
1183
  _ctx.$slots.header ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "header", {
848
1184
  key: 0,
849
1185
  titleClass: titleClass
@@ -885,7 +1221,7 @@ const _hoisted_2 = {
885
1221
  fn: (0, __WEBPACK_EXTERNAL_MODULE_vue__.withCtx)(()=>[
886
1222
  _ctx.$slots.footer ? (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "footer", {
887
1223
  key: 1
888
- }) : ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", _hoisted_2, [
1224
+ }) : ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", pro_dialogvue_type_script_setup_true_lang_ts_name_ProDialog_hoisted_2, [
889
1225
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElButton), {
890
1226
  onClick: handleCancel,
891
1227
  ref_key: "cancelBtnRef",
@@ -961,7 +1297,7 @@ const dbgrid_component_settingvue_type_script_setup_true_lang_tsx_hoisted_1 = {
961
1297
  const dbgrid_component_settingvue_type_script_setup_true_lang_tsx_hoisted_2 = {
962
1298
  class: "mb-4 mt-4 flex items-center justify-between"
963
1299
  };
964
- const _hoisted_3 = {
1300
+ const dbgrid_component_settingvue_type_script_setup_true_lang_tsx_hoisted_3 = {
965
1301
  class: "flex flex-1 overflow-hidden"
966
1302
  };
967
1303
  function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
@@ -1146,7 +1482,10 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1146
1482
  displayFlag: item.displayFlag,
1147
1483
  minWidth: item.minWidth,
1148
1484
  width: item.width,
1149
- prop: item.prop
1485
+ prop: item.prop,
1486
+ ascendSort: item.ascendSort,
1487
+ ascendFlag: item.ascendFlag,
1488
+ sortable: item.sortable
1150
1489
  }));
1151
1490
  if (serveDbgridComponentSettingList.value?.length) {
1152
1491
  let findObj = serveDbgridComponentSettingList.value.find((item)=>{
@@ -1340,7 +1679,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1340
1679
  _cache[6] || (_cache[6] = (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("span", null, "影响范围", -1)),
1341
1680
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElSelect), {
1342
1681
  disabled: !(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(isAdmin),
1343
- class: "ml-6 w-60",
1682
+ class: "ml-6 mr-4 w-52",
1344
1683
  modelValue: influenceScopeCode.value,
1345
1684
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event)=>influenceScopeCode.value = $event),
1346
1685
  clearable: false,
@@ -1366,7 +1705,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1366
1705
  ]),
1367
1706
  influenceScopeCode.value === (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.INFLUENCE_SCOPE_CODE).PRiVATE ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)((0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(__WEBPACK_EXTERNAL_MODULE_element_sun__.ElSelect), {
1368
1707
  key: 0,
1369
- class: "ml-4 w-60",
1708
+ class: "mr-4 w-52",
1370
1709
  filterable: true,
1371
1710
  disabled: !(0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(isAdmin),
1372
1711
  remote: true,
@@ -1391,6 +1730,13 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1391
1730
  }, 8, [
1392
1731
  "disabled",
1393
1732
  "modelValue"
1733
+ ])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true),
1734
+ (sourceData.value || []).find((item)=>item.sortable) ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createBlock)(AdvancedSort, {
1735
+ key: 1,
1736
+ "change-source-data": changeSourceData,
1737
+ data: sourceData.value
1738
+ }, null, 8, [
1739
+ "data"
1394
1740
  ])) : (0, __WEBPACK_EXTERNAL_MODULE_vue__.createCommentVNode)("", true)
1395
1741
  ]),
1396
1742
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", null, [
@@ -1419,7 +1765,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1419
1765
  ])
1420
1766
  ])
1421
1767
  ]),
1422
- (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", _hoisted_3, [
1768
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementVNode)("div", dbgrid_component_settingvue_type_script_setup_true_lang_tsx_hoisted_3, [
1423
1769
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(DbgridTableConfig, {
1424
1770
  ref_key: "dbgridTableConfigRef",
1425
1771
  ref: dbgridTableConfigRef,
@@ -1450,7 +1796,7 @@ function dbgrid_component_settingvue_type_script_setup_true_lang_tsx_isSlot(s) {
1450
1796
  const dbgrid_component_setting_exports_ = /*#__PURE__*/ (0, exportHelper["default"])(dbgrid_component_settingvue_type_script_setup_true_lang_tsx, [
1451
1797
  [
1452
1798
  '__scopeId',
1453
- "data-v-1e6d29ee"
1799
+ "data-v-3ade4ac1"
1454
1800
  ]
1455
1801
  ]);
1456
1802
  /* ESM default export */ const dbgrid_component_setting = dbgrid_component_setting_exports_;
@@ -1850,7 +2196,7 @@ const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_1 = {
1850
2196
  };
1851
2197
  const pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2 = {
1852
2198
  key: 1,
1853
- class: "mt-5 flex justify-between items-center"
2199
+ class: "mt-5 flex items-center justify-between"
1854
2200
  };
1855
2201
  const SELECTION = 'selection';
1856
2202
  // 接受父组件参数,配置默认值
@@ -1873,6 +2219,13 @@ const SELECTION = 'selection';
1873
2219
  componentNo: {
1874
2220
  default: ''
1875
2221
  },
2222
+ hiddenDefaultText: {
2223
+ type: Boolean,
2224
+ default: false
2225
+ },
2226
+ couldSortFieldList: {
2227
+ default: ()=>[]
2228
+ },
1876
2229
  fetchData: {
1877
2230
  type: Function,
1878
2231
  default: void 0
@@ -1932,10 +2285,12 @@ const SELECTION = 'selection';
1932
2285
  emits: [
1933
2286
  "drag-end",
1934
2287
  "size-page-change",
1935
- "current-page-change"
2288
+ "current-page-change",
2289
+ "sort-change"
1936
2290
  ],
1937
2291
  setup (__props, { expose: __expose, emit: __emit }) {
1938
2292
  const props = __props;
2293
+ const sortFieldList = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(void 0);
1939
2294
  const exportFileFlag = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)(__WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO);
1940
2295
  const componentDesc = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)('文件');
1941
2296
  let state = (0, __WEBPACK_EXTERNAL_MODULE_vue__.reactive)({
@@ -1959,6 +2314,8 @@ const SELECTION = 'selection';
1959
2314
  // 定义 emit 事件
1960
2315
  const emit = __emit;
1961
2316
  const attrs = (0, __WEBPACK_EXTERNAL_MODULE_vue__.useAttrs)();
2317
+ // 提供静态数据
2318
+ (0, __WEBPACK_EXTERNAL_MODULE_vue__.provide)('hiddenDefaultText', props.hiddenDefaultText);
1962
2319
  const tableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.ref)();
1963
2320
  const proTableRef = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>tableRef.value?.proTableRef);
1964
2321
  /**
@@ -2049,6 +2406,12 @@ const SELECTION = 'selection';
2049
2406
  componentDesc.value = result.data.componentDesc;
2050
2407
  try {
2051
2408
  let column = result.data.dbgridSettingValue && JSON.parse(result.data.dbgridSettingValue) || [];
2409
+ sortFieldList.value = column.filter((item)=>item.sortable && (item.ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO || item.ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES)).map((item)=>({
2410
+ fieldName: item.prop,
2411
+ ascendFlag: item.ascendFlag,
2412
+ sort: item.ascendSort
2413
+ }));
2414
+ proTableRef.value?.clearSort();
2052
2415
  serveColumns.value = column;
2053
2416
  } catch (error) {
2054
2417
  console.log(error);
@@ -2103,20 +2466,29 @@ const SELECTION = 'selection';
2103
2466
  /**
2104
2467
  * 支持根据传递的filterObj完成过滤
2105
2468
  */ const tableData = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
2106
- if (Object.keys(props.filterObj).length) return [
2469
+ let result = [
2107
2470
  ...state.tableData
2108
- ].filter((item)=>Object.keys(props.filterObj).every((cur)=>!props.filterObj[cur] && [
2471
+ ];
2472
+ if (sortFieldList.value?.length && !props.pagination) {
2473
+ let sortList = [
2474
+ ...sortFieldList.value
2475
+ ];
2476
+ sortList.sort((a, b)=>a.sort - b.sort);
2477
+ result = multiFieldSort(result, sortFieldList.value);
2478
+ }
2479
+ if (Object.keys(props.filterObj).length) return result.filter((item)=>Object.keys(props.filterObj).every((cur)=>!props.filterObj[cur] && [
2109
2480
  '',
2110
2481
  void 0,
2111
2482
  null
2112
2483
  ].includes(props.filterObj[cur]) || item[cur] === props.filterObj[cur]));
2113
- return state.tableData;
2484
+ return result;
2114
2485
  });
2115
2486
  __expose({
2116
2487
  selections,
2117
2488
  tableData,
2118
2489
  setCurrentRow,
2119
2490
  proTableRef,
2491
+ sortFieldList,
2120
2492
  eleTable: new Proxy({}, {
2121
2493
  get (_target, prop) {
2122
2494
  return proTableRef.value?.[prop];
@@ -2147,11 +2519,19 @@ const SELECTION = 'selection';
2147
2519
  /**
2148
2520
  * 处理接口和本地的columns
2149
2521
  */ const commonColumns = (0, __WEBPACK_EXTERNAL_MODULE_vue__.computed)(()=>{
2150
- if (!props.componentNo) return props.columns;
2522
+ let propsColumns = [
2523
+ ...props.columns
2524
+ ];
2525
+ if (props.couldSortFieldList && props.couldSortFieldList?.length) propsColumns = propsColumns.map((item)=>{
2526
+ let supportSort = !!(props.couldSortFieldList || []).find((cur)=>cur.fieldName === item.prop);
2527
+ return {
2528
+ sortable: !!supportSort && (props.pagination ? 'custom' : supportSort),
2529
+ ...item
2530
+ };
2531
+ });
2532
+ if (!props.componentNo) return propsColumns;
2151
2533
  {
2152
- let result = [
2153
- ...props.columns
2154
- ].map((cur)=>({
2534
+ let result = propsColumns.map((cur)=>({
2155
2535
  displayFlag: cur.isHidden || cur.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO ? __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO : __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.YES,
2156
2536
  ...cur
2157
2537
  }));
@@ -2193,6 +2573,32 @@ const SELECTION = 'selection';
2193
2573
  }
2194
2574
  return result.filter((item)=>!item.isHidden && !(props.componentNo && !serveColumns.value?.length && item.defaultDisplayFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.ENABLED_FLAG.NO));
2195
2575
  });
2576
+ function sortChange({ column, order, prop }) {
2577
+ if (!props.couldSortFieldList?.length) return emit('sort-change', {
2578
+ column,
2579
+ order,
2580
+ prop
2581
+ });
2582
+ let ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL;
2583
+ switch(order){
2584
+ case ASCENDING:
2585
+ ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.YES;
2586
+ break;
2587
+ case DESCENDING:
2588
+ ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.NO;
2589
+ break;
2590
+ default:
2591
+ ascendFlag = __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL;
2592
+ }
2593
+ if (ascendFlag === __WEBPACK_EXTERNAL_MODULE__sun_toolkit_enums__.FLAG.ALL) return sortFieldList.value = [];
2594
+ sortFieldList.value = [
2595
+ {
2596
+ fieldName: prop,
2597
+ ascendFlag,
2598
+ sort: 1
2599
+ }
2600
+ ];
2601
+ }
2196
2602
  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, [
2197
2603
  props?.draggable || props?.isShowDragTips ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", {
2198
2604
  key: 0,
@@ -2223,6 +2629,7 @@ const SELECTION = 'selection';
2223
2629
  "columns-setting": props.columnsSetting,
2224
2630
  loading: (0, __WEBPACK_EXTERNAL_MODULE_vue__.unref)(state).loading || props.loading,
2225
2631
  onSuccess: fetchDbgridComponent,
2632
+ onSortChange: sortChange,
2226
2633
  ref_key: "tableRef",
2227
2634
  ref: tableRef,
2228
2635
  data: tableData.value,
@@ -2252,7 +2659,7 @@ const SELECTION = 'selection';
2252
2659
  props.pagination ? ((0, __WEBPACK_EXTERNAL_MODULE_vue__.openBlock)(), (0, __WEBPACK_EXTERNAL_MODULE_vue__.createElementBlock)("div", pro_tablevue_type_script_lang_ts_setup_true_name_ProTable_hoisted_2, [
2253
2660
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.renderSlot)(_ctx.$slots, "pagination"),
2254
2661
  (0, __WEBPACK_EXTERNAL_MODULE_vue__.createVNode)(Pagination, {
2255
- class: "w-full flex justify-end",
2662
+ class: "flex w-full justify-end",
2256
2663
  layout: props.layout,
2257
2664
  "page-info": paginationInfo.value,
2258
2665
  "page-sizes": props.pageSizes,