3h1-ui 2.1.12 → 2.1.14

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/es/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h, nextTick, createVNode, defineComponent, ref, computed, unref, watchEffect, watch, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, Fragment, renderList, createTextVNode, toDisplayString, createSlots, renderSlot, normalizeProps, guardReactiveProps, createElementVNode, onMounted, normalizeClass, createCommentVNode, normalizeStyle, Transition, toHandlers, useSlots, withDirectives, vShow, getCurrentInstance, inject, onUnmounted, provide, onBeforeUnmount, resolveDynamicComponent, reactive, toRef, toRefs, TransitionGroup, getCurrentScope, onScopeDispose, readonly, isVNode, shallowReactive, toRaw, shallowRef, withKeys, withModifiers, render as render$1, resolveDirective, isRef, useAttrs as useAttrs$2 } from "vue";
2
2
  import { Radio, Select, Tree, TreeSelect, Cascader, Transfer, Input, Tooltip, Skeleton, Popover, Pagination, Empty, Button as Button$1, Table as Table$1, Form, FormItem, DatePicker, InputNumber, AutoComplete, Switch, Checkbox, Slider, Rate, TimePicker, Divider, Col, Popconfirm, Modal as Modal$2, Row, Dropdown, Menu, MenuItem, MenuDivider, Spin, PageHeader, Image, Badge, Tag, FormItemRest, Descriptions, Drawer, Space, Upload, Avatar } from "ant-design-vue";
3
3
  import { propTypes, isFunction as isFunction$4, isString as isString$3, isArray as isArray$3, getSlot as getSlot$1, addClass as addClass$1, removeClass as removeClass$1, getPopupContainer as getPopupContainer$1, triggerWindowResize, off, on, addResizeListener, removeResizeListener, isNumber as isNumber$2, isBoolean, isNull, extendSlots as extendSlots$1, withInstall as withInstall$1, isObject as isObject$3, dateUtil, isNullOrUnDef, isDef as isDef$1, error as error$1, deepMerge as deepMerge$1, getDynamicProps, buildProps, createBEM, forEach as forEach$1, isClient as isClient$1, filter, treeToList, eachTree, isEmpty, isServer, formatToDate, isMap as isMap$2, buildUUID, findNodeAll, getViewportOffset, warn as warn$1, isNullAndUnDef, dataURLtoBlob } from "@shy-plugins/utils";
4
- import { useAttrs as useAttrs$1, useRuleFormItem, useTimeoutFn as useTimeoutFn$2, useScrollTo as useScrollTo$1, useIntersectionObserver, useCopyToClipboard, useMessage, usePagination as usePagination$1, createContext as createContext$1, useContext as useContext$2, useBreakpoint, useI18n as useI18n$1, useContentHeight, useDesign as useDesign$1, useWindowSizeFn as useWindowSizeFn$1, onMountedOrActivated, useEventListener as useEventListener$1 } from "@shy-plugins/use";
4
+ import { useAttrs as useAttrs$1, useRuleFormItem, useTimeoutFn as useTimeoutFn$2, useScrollTo as useScrollTo$1, useIntersectionObserver, useCopyToClipboard, useMessage, usePagination as usePagination$2, createContext as createContext$1, useContext as useContext$2, useBreakpoint, useI18n as useI18n$1, useContentHeight, useDesign as useDesign$1, useWindowSizeFn as useWindowSizeFn$1, onMountedOrActivated, useEventListener as useEventListener$1 } from "@shy-plugins/use";
5
5
  import { zxcvbn } from "@zxcvbn-ts/core";
6
6
  import Iconify from "@purge-icons/generated";
7
7
  import Sortablejs from "sortablejs";
@@ -6856,7 +6856,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
6856
6856
  const debounceHandleSearchChange = useDebounceFn$1(handleSearchChange, 100);
6857
6857
  const { clipboardRef, isSuccessRef } = useCopyToClipboard(props2.value);
6858
6858
  const { createMessage } = useMessage();
6859
- const { getPaginationList, getTotal, setCurrentPage } = usePagination$1(
6859
+ const { getPaginationList, getTotal, setCurrentPage } = usePagination$2(
6860
6860
  currentList,
6861
6861
  props2.pageSize
6862
6862
  );
@@ -11862,7 +11862,7 @@ function itemRender({
11862
11862
  }
11863
11863
  return originalElement;
11864
11864
  }
11865
- function usePagination(refProps) {
11865
+ function usePagination$1(refProps) {
11866
11866
  const configRef = ref({});
11867
11867
  const show = ref(true);
11868
11868
  watch(() => unref(refProps).pagination, (pagination) => {
@@ -14599,7 +14599,7 @@ const _sfc_main$i = defineComponent({
14599
14599
  setPagination,
14600
14600
  setShowPagination,
14601
14601
  getShowPagination
14602
- } = usePagination(getProps);
14602
+ } = usePagination$1(getProps);
14603
14603
  const {
14604
14604
  getRowSelection,
14605
14605
  getRowSelectionRef,
@@ -19993,6 +19993,53 @@ const basicColumn = {
19993
19993
  const basicFormConfig = {
19994
19994
  labelWidth: 80
19995
19995
  };
19996
+ const usePagination = () => {
19997
+ const page = reactive({
19998
+ total: 0,
19999
+ current: 1,
20000
+ pageSize: 10,
20001
+ pageSizeOptions: ["10", "20", "30", "40"]
20002
+ });
20003
+ const setPage = (pageInfo) => {
20004
+ nextTick(() => {
20005
+ Object.keys(pageInfo).forEach((key2) => {
20006
+ page[key2] = pageInfo[key2];
20007
+ });
20008
+ });
20009
+ };
20010
+ return { page, setPage };
20011
+ };
20012
+ const useTableData = (getProps, { setPage, params }) => {
20013
+ const dataSource = ref([]);
20014
+ const setTableData = (data) => {
20015
+ dataSource.value = data.map((item) => {
20016
+ item._isEdit = false;
20017
+ return item;
20018
+ });
20019
+ };
20020
+ const getTableData = () => {
20021
+ return dataSource.value;
20022
+ };
20023
+ const reload = async () => {
20024
+ var _a2;
20025
+ if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
20026
+ const res = await getProps.value.api(params.value);
20027
+ setTableData(res.records);
20028
+ setPage({ total: (res == null ? void 0 : res.total) || 0 });
20029
+ }
20030
+ };
20031
+ onMounted(async () => {
20032
+ if (getProps.value.isImmediate) {
20033
+ await reload();
20034
+ }
20035
+ });
20036
+ return {
20037
+ dataSource,
20038
+ setTableData,
20039
+ reload,
20040
+ getTableData
20041
+ };
20042
+ };
19996
20043
  const __default__ = defineComponent({
19997
20044
  name: "TablePlus"
19998
20045
  });
@@ -20070,6 +20117,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20070
20117
  return { ...basicColumn, ...item };
20071
20118
  });
20072
20119
  });
20120
+ const { page, setPage } = usePagination();
20073
20121
  const getFormConfig = computed(() => {
20074
20122
  return {
20075
20123
  ...getProps.value.formConfig,
@@ -20080,7 +20128,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
20080
20128
  ...basicFormConfig,
20081
20129
  ...getFormConfig.value
20082
20130
  });
20083
- ref({});
20131
+ const formSearch = ref({});
20132
+ const params = computed(() => {
20133
+ return {
20134
+ ...getProps.value.searchInfo,
20135
+ ...formSearch.value,
20136
+ current: page.current,
20137
+ size: page.pageSize
20138
+ };
20139
+ });
20140
+ useTableData(
20141
+ getProps,
20142
+ {
20143
+ setPage,
20144
+ params
20145
+ }
20146
+ );
20084
20147
  const tableRef = ref();
20085
20148
  const getRowSelection = () => {
20086
20149
  if (getProps.value.configRowSelection.type === "checkbox") {
package/lib/index.js CHANGED
@@ -11864,7 +11864,7 @@ function itemRender({
11864
11864
  }
11865
11865
  return originalElement;
11866
11866
  }
11867
- function usePagination(refProps) {
11867
+ function usePagination$1(refProps) {
11868
11868
  const configRef = vue.ref({});
11869
11869
  const show = vue.ref(true);
11870
11870
  vue.watch(() => vue.unref(refProps).pagination, (pagination) => {
@@ -14601,7 +14601,7 @@ const _sfc_main$i = vue.defineComponent({
14601
14601
  setPagination,
14602
14602
  setShowPagination,
14603
14603
  getShowPagination
14604
- } = usePagination(getProps);
14604
+ } = usePagination$1(getProps);
14605
14605
  const {
14606
14606
  getRowSelection,
14607
14607
  getRowSelectionRef,
@@ -19995,6 +19995,53 @@ const basicColumn = {
19995
19995
  const basicFormConfig = {
19996
19996
  labelWidth: 80
19997
19997
  };
19998
+ const usePagination = () => {
19999
+ const page = vue.reactive({
20000
+ total: 0,
20001
+ current: 1,
20002
+ pageSize: 10,
20003
+ pageSizeOptions: ["10", "20", "30", "40"]
20004
+ });
20005
+ const setPage = (pageInfo) => {
20006
+ vue.nextTick(() => {
20007
+ Object.keys(pageInfo).forEach((key2) => {
20008
+ page[key2] = pageInfo[key2];
20009
+ });
20010
+ });
20011
+ };
20012
+ return { page, setPage };
20013
+ };
20014
+ const useTableData = (getProps, { setPage, params }) => {
20015
+ const dataSource = vue.ref([]);
20016
+ const setTableData = (data) => {
20017
+ dataSource.value = data.map((item) => {
20018
+ item._isEdit = false;
20019
+ return item;
20020
+ });
20021
+ };
20022
+ const getTableData = () => {
20023
+ return dataSource.value;
20024
+ };
20025
+ const reload = async () => {
20026
+ var _a2;
20027
+ if ((_a2 = getProps.value) == null ? void 0 : _a2.api) {
20028
+ const res = await getProps.value.api(params.value);
20029
+ setTableData(res.records);
20030
+ setPage({ total: (res == null ? void 0 : res.total) || 0 });
20031
+ }
20032
+ };
20033
+ vue.onMounted(async () => {
20034
+ if (getProps.value.isImmediate) {
20035
+ await reload();
20036
+ }
20037
+ });
20038
+ return {
20039
+ dataSource,
20040
+ setTableData,
20041
+ reload,
20042
+ getTableData
20043
+ };
20044
+ };
19998
20045
  const __default__ = vue.defineComponent({
19999
20046
  name: "TablePlus"
20000
20047
  });
@@ -20072,6 +20119,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20072
20119
  return { ...basicColumn, ...item };
20073
20120
  });
20074
20121
  });
20122
+ const { page, setPage } = usePagination();
20075
20123
  const getFormConfig = vue.computed(() => {
20076
20124
  return {
20077
20125
  ...getProps.value.formConfig,
@@ -20082,7 +20130,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
20082
20130
  ...basicFormConfig,
20083
20131
  ...getFormConfig.value
20084
20132
  });
20085
- vue.ref({});
20133
+ const formSearch = vue.ref({});
20134
+ const params = vue.computed(() => {
20135
+ return {
20136
+ ...getProps.value.searchInfo,
20137
+ ...formSearch.value,
20138
+ current: page.current,
20139
+ size: page.pageSize
20140
+ };
20141
+ });
20142
+ useTableData(
20143
+ getProps,
20144
+ {
20145
+ setPage,
20146
+ params
20147
+ }
20148
+ );
20086
20149
  const tableRef = vue.ref();
20087
20150
  const getRowSelection = () => {
20088
20151
  if (getProps.value.configRowSelection.type === "checkbox") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "3h1-ui",
3
- "version": "2.1.12",
3
+ "version": "2.1.14",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -31,8 +31,8 @@
31
31
  "vue-types": "^5.0.2",
32
32
  "vxe-table": "^4.3.6",
33
33
  "xe-utils": "^3.5.7",
34
- "@shy-plugins/utils": "1.0.14",
35
- "@shy-plugins/use": "1.0.3"
34
+ "@shy-plugins/use": "1.0.3",
35
+ "@shy-plugins/utils": "1.0.14"
36
36
  },
37
37
  "types": "es/ui/index.d.ts",
38
38
  "devDependencies": {