@maxax/ui 1.1.76 → 1.1.77

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/index.mjs CHANGED
@@ -8582,19 +8582,33 @@ function parseRowKeyValue$1(rowKey, record, autoCreateKey) {
8582
8582
  function setTableGlobalFormats(formats) {
8583
8583
  VxeUI2.formats.mixin(formats);
8584
8584
  }
8585
+ function setTableGlobalFilterRenderers(renderers) {
8586
+ VxeUI2.renderer.mixin(renderers);
8587
+ }
8588
+ function parseFilterInfo(filterList = []) {
8589
+ return filterList.reduce((filterInfo, item) => {
8590
+ filterInfo[item.field] = item.datas.length > 1 ? item.datas : item.datas[0];
8591
+ return filterInfo;
8592
+ }, {});
8593
+ }
8585
8594
  function useDataSource$1(propsRef, { tableData, getPaginationInfo, setPagination, setSelection, setLoading, emit }) {
8586
8595
  const searchState = reactive({
8587
8596
  sortInfo: {},
8588
8597
  filterInfo: {}
8589
8598
  });
8590
8599
  const getSortRef = computed(() => {
8591
- const { onSortChange } = unref(propsRef);
8600
+ const { onFilterChange, onSortChange } = unref(propsRef);
8592
8601
  return {
8593
8602
  onSortChange: (params) => {
8594
8603
  searchState.sortInfo.ascSortColumn = params.order === "asc" ? params.field : "";
8595
8604
  searchState.sortInfo.descSortColumn = params.order === "desc" ? params.field : "";
8596
8605
  onSortChange && onSortChange(params);
8597
8606
  fetch2();
8607
+ },
8608
+ onFilterChange: (params) => {
8609
+ searchState.filterInfo = parseFilterInfo(params.filterList);
8610
+ onFilterChange && onFilterChange(params);
8611
+ fetch2();
8598
8612
  }
8599
8613
  };
8600
8614
  });
@@ -9686,6 +9700,69 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
9686
9700
  };
9687
9701
  }
9688
9702
  });
9703
+ const BASIC_TABLE_FILTER_INPUT_RENDERER = "XBasicTableFilterInput";
9704
+ function isEmptyValue(value) {
9705
+ return value === null || value === void 0 || value === "";
9706
+ }
9707
+ function updateFilterOptionStatus(params, option) {
9708
+ params.$table.updateFilterOptionStatus(option, !isEmptyValue(option.data));
9709
+ }
9710
+ function callFilterEvent(events, name, params, payload) {
9711
+ var _a;
9712
+ (_a = events == null ? void 0 : events[name]) == null ? void 0 : _a.call(events, params, payload);
9713
+ }
9714
+ const basicTableFilterRenderers = {
9715
+ [BASIC_TABLE_FILTER_INPUT_RENDERER]: {
9716
+ tableFilterClassName: "x-basic-table-filter-input",
9717
+ showTableFilterFooter: true,
9718
+ createTableFilterOptions: () => [{
9719
+ data: ""
9720
+ }],
9721
+ renderTableFilter(renderOpts, params) {
9722
+ const {
9723
+ props = {},
9724
+ attrs = {},
9725
+ events = {}
9726
+ } = renderOpts;
9727
+ return params.column.filters.map((option, index2) => {
9728
+ return createVNode(NInput, mergeProps({
9729
+ "key": index2,
9730
+ "clearable": true,
9731
+ "placeholder": "请输入筛选内容"
9732
+ }, attrs, props, {
9733
+ "value": option.data,
9734
+ "onUpdateValue": (value) => {
9735
+ option.data = value;
9736
+ updateFilterOptionStatus(params, option);
9737
+ callFilterEvent(events, "update:value", params, value);
9738
+ },
9739
+ "onChange": (value) => {
9740
+ updateFilterOptionStatus(params, option);
9741
+ callFilterEvent(events, "change", params, value);
9742
+ },
9743
+ "onBlur": (event) => {
9744
+ updateFilterOptionStatus(params, option);
9745
+ callFilterEvent(events, "blur", params, event);
9746
+ },
9747
+ "onKeydown": (event) => {
9748
+ if (event.key !== "Enter") return;
9749
+ event.preventDefault();
9750
+ updateFilterOptionStatus(params, option);
9751
+ params.$table.saveFilterByEvent(event, params.column);
9752
+ callFilterEvent(events, "keydown", params, event);
9753
+ }
9754
+ }), null);
9755
+ });
9756
+ },
9757
+ tableFilterDefaultMethod({
9758
+ option,
9759
+ cellValue
9760
+ }) {
9761
+ if (isEmptyValue(option.data)) return true;
9762
+ return String(cellValue != null ? cellValue : "").includes(String(option.data));
9763
+ }
9764
+ }
9765
+ };
9689
9766
  const formatterFYN = (value) => {
9690
9767
  return value ? t("max.basic.yes") : t("max.basic.no");
9691
9768
  };
@@ -13920,7 +13997,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
13920
13997
  ...itemProps,
13921
13998
  style: {
13922
13999
  "--n-feedback-height": "16px",
13923
- "--n-label-padding": "0 12px 0 12px"
14000
+ "--n-label-padding": props.formProps.labelPlacement === "top" ? "0" : "0 12px 0 12px"
13924
14001
  }
13925
14002
  };
13926
14003
  const getContent = () => {
@@ -14454,8 +14531,9 @@ function getDefaultValue(schema, defaultValueRef, key2) {
14454
14531
  }
14455
14532
  function useFormGrid(propsRef) {
14456
14533
  const getRow = computed(() => {
14457
- const { baseRowStyle = {}, rowProps } = unref(propsRef);
14534
+ const { baseRowStyle = {}, labelPlacement, rowProps } = unref(propsRef);
14458
14535
  return {
14536
+ gutter: labelPlacement === "top" ? [16, 0] : 0,
14459
14537
  style: baseRowStyle,
14460
14538
  ...rowProps
14461
14539
  };
@@ -30902,6 +30980,7 @@ const vxeTableFormatter = {
30902
30980
  }
30903
30981
  };
30904
30982
  VxeUI2.formats.mixin(vxeTableFormatter);
30983
+ VxeUI2.renderer.mixin(basicTableFilterRenderers);
30905
30984
  VxeUI2.setConfig({
30906
30985
  zIndex: 2e3
30907
30986
  });
@@ -31669,6 +31748,7 @@ const updateConfig = () => {
31669
31748
  updateConfig();
31670
31749
  const install = installer.install;
31671
31750
  export {
31751
+ BASIC_TABLE_FILTER_INPUT_RENDERER,
31672
31752
  LIST_IGNORE,
31673
31753
  MaxUI,
31674
31754
  VxeUI3 as TableGlobal,
@@ -31779,6 +31859,7 @@ export {
31779
31859
  basicScrollTextProps,
31780
31860
  basicSelectProps,
31781
31861
  basicSubPanelProps,
31862
+ basicTableFilterRenderers,
31782
31863
  basicUploadDraggerProps,
31783
31864
  basicUploadProps,
31784
31865
  configProviderProps,
@@ -31794,6 +31875,7 @@ export {
31794
31875
  notificationTypes,
31795
31876
  provideGlobalConfig,
31796
31877
  responsiveArray,
31878
+ setTableGlobalFilterRenderers,
31797
31879
  setTableGlobalFormats,
31798
31880
  treeNodeProps,
31799
31881
  treeNodePropsPass$1 as treeNodePropsPass,