@unicom-cloud/ui 0.8.114 → 0.8.115

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/list/index.js CHANGED
@@ -4,6 +4,7 @@ import Mt from "lodash/isArray";
4
4
  import At from "lodash/throttle";
5
5
  import { a as Ht } from "../chunk/DstheLSK.js";
6
6
  import { u as Tt } from "../chunk/FgWHhRFz.js";
7
+ import "../pagination/PageOption.js";
7
8
  import Bt from "../pagination/Pagination.js";
8
9
  import J from "../row-col/index.js";
9
10
  import Vt from "../spin/index.js";
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@unicom-cloud/ui","version":"0.8.114","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.18","lodash":"^4.17.21","react":"^19.1.1","react-dom":"^19.1.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
1
+ {"name":"@unicom-cloud/ui","version":"0.8.115","dependencies":{"@unicom-cloud/icons":"latest"},"peerDependencies":{"dayjs":"^1.11.18","lodash":"^4.17.21","react":"^19.1.1","react-dom":"^19.1.1"},"peerDependenciesMeta":{},"type":"module","types":"types/pc/index.d.ts","main":"./index.js","publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"}}
@@ -1,42 +1,114 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import P, { useRef as d, useContext as C } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import S, { useRef as h, useContext as b } from "react";
3
3
  import { a as x } from "../chunk/DstheLSK.js";
4
- import r from "../select/Select.js";
5
- function z(s) {
6
- const p = () => {
7
- }, c = [10, 20, 30, 40, 50], t = d(null), { locale: i } = C(x), {
8
- onPageSizeChange: l = p,
9
- rootPrefixCls: f,
10
- sizeOptions: o = c,
11
- pageSize: a = 10,
12
- size: g,
13
- selectProps: m,
14
- disabled: u
15
- } = s;
16
- return /* @__PURE__ */ n(
4
+ import u from "../select/Select.js";
5
+ import "@unicom-cloud/utils/case-name";
6
+ import "@unicom-cloud/utils/class-name";
7
+ import "@unicom-cloud/utils/constant/ui";
8
+ import "@unicom-cloud/utils/clipboard-copy";
9
+ import "@unicom-cloud/utils/date";
10
+ import "../chunk/DS_deHpN.js";
11
+ import "../chunk/BcdTSJks.js";
12
+ import "@unicom-cloud/utils/emitter";
13
+ import "@unicom-cloud/utils/file/fileToURL";
14
+ import "lodash/escapeRegExp";
15
+ import "lodash/isArray";
16
+ import "lodash/isNumber";
17
+ import "lodash/isString";
18
+ import "lodash/isFunction";
19
+ import "lodash/throttle";
20
+ import "../chunk/DsaQZE4X.js";
21
+ import "lodash/camelCase";
22
+ import "lodash/capitalize";
23
+ import "lodash/cloneDeep";
24
+ import "lodash/debounce";
25
+ import "lodash/defaultsDeep";
26
+ import "lodash/get";
27
+ import "lodash/has";
28
+ import "lodash/kebabCase";
29
+ import "lodash/merge";
30
+ import "lodash/mergeWith";
31
+ import "lodash/set";
32
+ import "lodash/setWith";
33
+ import "lodash/snakeCase";
34
+ import "lodash/startCase";
35
+ import "lodash/uniq";
36
+ import "lodash/upperFirst";
37
+ import "@unicom-cloud/utils/math";
38
+ import "lodash/isPlainObject";
39
+ import "@unicom-cloud/utils/pinyin";
40
+ import "../chunk/BJ9_azwQ.js";
41
+ import "../chunk/exc7v_Hl.js";
42
+ import "../utils/responsiveObserve.js";
43
+ import "@unicom-cloud/utils/file/saveAs";
44
+ import "@unicom-cloud/utils/screenfull";
45
+ import "@unicom-cloud/utils/tinycolor";
46
+ import "@unicom-cloud/utils/ui-color";
47
+ import "@unicom-cloud/utils/constant/ui.js";
48
+ import "react-is";
49
+ import "@unicom-cloud/utils/tree";
50
+ import { isBoolean as z, isNumber as v } from "@unicom-cloud/utils/is";
51
+ import "uuid";
52
+ import "../chunk/DmHIX8hU.js";
53
+ import "@unicom-cloud/utils/constant/keyboardCode";
54
+ const w = [10, 20, 30, 40, 50];
55
+ function I(f) {
56
+ const c = () => {
57
+ }, a = h(null), { locale: n } = b(x), {
58
+ onPageSizeChange: g = c,
59
+ rootPrefixCls: P,
60
+ sizeOptions: t = w,
61
+ pageSize: p = 10,
62
+ size: C,
63
+ selectProps: l,
64
+ disabled: d,
65
+ allowCreate: O
66
+ } = f;
67
+ let i = t[0], r = O ?? l.allowCreate;
68
+ r ? (z(r) && (r = {
69
+ formatter(o, N) {
70
+ let e = +o;
71
+ return v(e) || (e = t[0]), {
72
+ value: e,
73
+ label: s(e)
74
+ };
75
+ }
76
+ }), i = p) : t.indexOf(p) === -1 || (i = p), i ??= t[0];
77
+ function s(o) {
78
+ return `${o} ${n?.Pagination?.countPerPage}`;
79
+ }
80
+ return /* @__PURE__ */ m(
17
81
  "div",
18
82
  {
19
- ref: t,
20
- className: `${f}-option`,
21
- "aria-label": i?.Pagination?.pageSize,
22
- children: /* @__PURE__ */ n(
23
- r,
83
+ ref: a,
84
+ className: `${P}-option`,
85
+ "aria-label": n?.Pagination?.pageSize,
86
+ children: /* @__PURE__ */ m(
87
+ u,
24
88
  {
25
- value: o.indexOf(a) !== -1 ? a : o[0],
26
- onChange: (e) => {
27
- l(e);
89
+ defaultValue: t[0],
90
+ value: i,
91
+ size: C,
92
+ getPopupContainer: () => a.current,
93
+ disabled: d,
94
+ triggerProps: {
95
+ autoAlignPopupWidth: !1,
96
+ autoAlignPopupMinWidth: !0,
97
+ position: "bl"
98
+ },
99
+ onChange: (o) => {
100
+ g(o);
28
101
  },
29
- size: g,
30
- getPopupContainer: () => t.current,
31
- disabled: u,
32
- ...m,
33
- children: o.map((e) => /* @__PURE__ */ n(r.Option, { value: e, children: `${e} ${i?.Pagination?.countPerPage}` }, e))
102
+ ...l,
103
+ allowCreate: r,
104
+ children: t.map((o) => /* @__PURE__ */ m(u.Option, { value: o, children: s(o) }, o))
34
105
  }
35
106
  )
36
107
  }
37
108
  );
38
109
  }
39
- const v = P.memo(z);
110
+ const $o = S.memo(I);
40
111
  export {
41
- v as default
112
+ w as PAGE_SIZE_OPTIONS,
113
+ $o as default
42
114
  };
@@ -1,40 +1,40 @@
1
1
  import { jsxs as O, jsx as c } from "react/jsx-runtime";
2
- import D, { forwardRef as we, useContext as Ne, useEffect as W, createElement as P } from "react";
3
- import { a as $e } from "../chunk/DstheLSK.js";
4
- import { u as ve } from "../chunk/FgWHhRFz.js";
2
+ import D, { forwardRef as Ne, useContext as $e, useEffect as W, createElement as P } from "react";
3
+ import { a as ve } from "../chunk/DstheLSK.js";
4
+ import { u as be } from "../chunk/FgWHhRFz.js";
5
5
  import { u as q } from "../chunk/2vdCeheu.js";
6
- import be from "@unicom-cloud/utils/class-name";
7
- import { a as Me } from "../chunk/ClqoGc3r.js";
6
+ import Me from "@unicom-cloud/utils/class-name";
7
+ import { a as je } from "../chunk/ClqoGc3r.js";
8
8
  import N, { StepPager as $, JumpPager as E } from "./PageItem.js";
9
9
  import G from "./PageJumper.js";
10
- import je from "./PageOption.js";
10
+ import ke from "./PageOption.js";
11
11
  import { StepType as m } from "./interface.js";
12
- const ke = 1, K = 10;
12
+ const Je = 1, K = 10;
13
13
  function R(g = K, d) {
14
14
  return Math.ceil(d / g);
15
15
  }
16
- function Je(g, d) {
16
+ function Ae(g, d) {
17
17
  const v = Math.floor(d / 2) - 1, b = Math.max(g, 0);
18
18
  return Math.min(b, v);
19
19
  }
20
20
  function H(g) {
21
21
  return g && g.length ? g[0] : K;
22
22
  }
23
- const Ae = {
23
+ const Oe = {
24
24
  total: 0,
25
25
  pageSizeChangeResetCurrent: !0,
26
26
  bufferSize: 2
27
27
  };
28
- function Oe(g, d) {
28
+ function Ee(g, d) {
29
29
  const {
30
30
  getPrefixCls: F,
31
31
  size: v,
32
32
  locale: b,
33
33
  componentConfig: Q,
34
34
  rtl: U
35
- } = Ne($e), i = ve(
35
+ } = $e(ve), i = be(
36
36
  g,
37
- Ae,
37
+ Oe,
38
38
  Q?.Pagination
39
39
  ), {
40
40
  className: X,
@@ -59,9 +59,11 @@ function Oe(g, d) {
59
59
  pageSizeChangeResetCurrent: T,
60
60
  defaultCurrent: ce,
61
61
  defaultPageSize: pe,
62
- showPageOption: ge
62
+ showPageOption: ge,
63
63
  // 潘启宝添加
64
- } = i, fe = C ? !1 : ge, [e, j] = q(ke, {
64
+ allowCreate: fe
65
+ // 潘启宝添加
66
+ } = i, me = C ? !1 : ge, [e, j] = q(Je, {
65
67
  defaultValue: ce,
66
68
  value: I
67
69
  }), [f, V] = q(
@@ -70,11 +72,11 @@ function Oe(g, d) {
70
72
  defaultValue: pe,
71
73
  value: le
72
74
  }
73
- ), h = ie, me = !!ue;
75
+ ), h = ie, he = !!ue;
74
76
  I && !i.onChange && console.warn(
75
77
  "Warning: you have provide current prop for pagination but without onChange handler , this will cause no-change when you change page. "
76
78
  );
77
- function he(t, l) {
79
+ function Pe(t, l) {
78
80
  const n = R(t, l);
79
81
  return e > n ? n : e;
80
82
  }
@@ -84,20 +86,20 @@ function Oe(g, d) {
84
86
  "pageSize" in i || V(l);
85
87
  }
86
88
  }, [S]), W(() => {
87
- const t = he(f, h);
89
+ const t = Pe(f, h);
88
90
  t !== e && !("current" in i) && j(t);
89
91
  }, [h, e, f]);
90
92
  const B = (t = e, l = f) => {
91
93
  const { onChange: n } = i;
92
94
  n?.(t, l);
93
- }, Pe = (t) => {
95
+ }, de = (t) => {
94
96
  const { onPageSizeChange: l } = i, n = R(t, h), a = {
95
97
  pageSize: t
96
98
  };
97
99
  T ? a.current = 1 : a.current = e > n ? n : e, "pageSize" in i || V(a.pageSize), !("current" in i) && e !== a.current && j(a.current), l?.(t, a.current), B(T ? 1 : a.current, t);
98
100
  }, k = (t) => {
99
101
  "current" in i || j(t), B(t);
100
- }, de = i.size || v, o = F?.("pagination"), y = ne ? "mini" : de, Ce = be(
102
+ }, Ce = i.size || v, o = F?.("pagination"), y = ne ? "mini" : Ce, ze = Me(
101
103
  o,
102
104
  `${o}-size-${y}`,
103
105
  {
@@ -108,7 +110,7 @@ function Oe(g, d) {
108
110
  X
109
111
  );
110
112
  let J;
111
- const r = [], s = R(f, h), p = Je(i.bufferSize, s);
113
+ const r = [], s = R(f, h), p = Ae(i.bufferSize, s);
112
114
  if (se && s <= 1)
113
115
  return null;
114
116
  const u = {
@@ -156,7 +158,7 @@ function Oe(g, d) {
156
158
  e > t && e < l ? (a = e + p, n = e - p) : e <= t ? (L = !1, n = 1, a = Math.max(t, p + e)) : e >= l && (_ = !1, a = s, n = Math.min(l, e - p));
157
159
  for (let w = n; w <= a; w++)
158
160
  r.push(/* @__PURE__ */ c(N, { pageNum: w, ...u }, w));
159
- const ze = /* @__PURE__ */ P(
161
+ const Se = /* @__PURE__ */ P(
160
162
  E,
161
163
  {
162
164
  ...u,
@@ -164,7 +166,7 @@ function Oe(g, d) {
164
166
  type: m.previous,
165
167
  jumpPage: -(p * 2 + 1)
166
168
  }
167
- ), Se = /* @__PURE__ */ P(
169
+ ), xe = /* @__PURE__ */ P(
168
170
  E,
169
171
  {
170
172
  ...u,
@@ -172,20 +174,20 @@ function Oe(g, d) {
172
174
  type: m.next,
173
175
  jumpPage: p * 2 + 1
174
176
  }
175
- ), xe = /* @__PURE__ */ c(N, { pageNum: 1, ...u }, 1), ye = /* @__PURE__ */ P(N, { ...u, key: s, pageNum: s });
177
+ ), ye = /* @__PURE__ */ c(N, { pageNum: 1, ...u }, 1), we = /* @__PURE__ */ P(N, { ...u, key: s, pageNum: s });
176
178
  L && (r[0] = D.cloneElement(r[0], {
177
179
  className: `${o}-item-after-pre`
178
- }), r.unshift(ze), r.unshift(xe)), _ && (r[r.length - 1] = D.cloneElement(
180
+ }), r.unshift(Se), r.unshift(ye)), _ && (r[r.length - 1] = D.cloneElement(
179
181
  r[r.length - 1],
180
182
  {
181
183
  className: `${o}-item-before-next`
182
184
  }
183
- ), r.push(Se), r.push(ye));
185
+ ), r.push(xe), r.push(we));
184
186
  }
185
187
  J = /* @__PURE__ */ O("ul", { className: `${o}-list`, children: [
186
188
  /* @__PURE__ */ P($, { ...u, key: "previous", type: m.previous }),
187
189
  r,
188
- me && /* @__PURE__ */ P(
190
+ he && /* @__PURE__ */ P(
189
191
  E,
190
192
  {
191
193
  ...u,
@@ -201,23 +203,24 @@ function Oe(g, d) {
201
203
  return typeof x == "boolean" && x && (A = /* @__PURE__ */ c("div", { className: `${o}-total-text`, children: b?.Pagination?.total?.replace?.("{0}", h) })), typeof x == "function" && (A = /* @__PURE__ */ c("div", { className: `${o}-total-text`, children: x(h, [(e - 1) * f + 1, e * f]) })), /* @__PURE__ */ O(
202
204
  "div",
203
205
  {
204
- ...Me(i),
205
- className: Ce,
206
+ ...je(i),
207
+ className: ze,
206
208
  style: Y,
207
209
  ref: d,
208
210
  children: [
209
211
  A,
210
212
  J,
211
- fe !== !1 && /* @__PURE__ */ c(
212
- je,
213
+ me !== !1 && /* @__PURE__ */ c(
214
+ ke,
213
215
  {
214
216
  disabled: z,
215
217
  rootPrefixCls: o,
216
218
  sizeOptions: te,
217
- onPageSizeChange: Pe,
219
+ onPageSizeChange: de,
218
220
  pageSize: f,
219
221
  size: y,
220
- selectProps: oe
222
+ selectProps: oe,
223
+ allowCreate: fe
221
224
  }
222
225
  ),
223
226
  !C && M && /* @__PURE__ */ c(
@@ -235,8 +238,8 @@ function Oe(g, d) {
235
238
  }
236
239
  );
237
240
  }
238
- const Ee = we(Oe);
239
- Ee.displayName = "Pagination";
241
+ const Re = Ne(Ee);
242
+ Re.displayName = "Pagination";
240
243
  export {
241
- Ee as default
244
+ Re as default
242
245
  };
@@ -1,4 +1,6 @@
1
+ import { PAGE_SIZE_OPTIONS as e } from "./PageOption.js";
1
2
  import t from "./Pagination.js";
2
3
  export {
4
+ e as PAGE_SIZE_OPTIONS,
3
5
  t as default
4
6
  };
package/table/Table.js CHANGED
@@ -18,6 +18,7 @@ import "../chunk/Bl3hZtxi.js";
18
18
  import "@unicom-cloud/utils/query-string";
19
19
  import "react-router";
20
20
  import "../chunk/CVMFAeSw.js";
21
+ import "../pagination/PageOption.js";
21
22
  import "../pagination/Pagination.js";
22
23
  import "../spin/index.js";
23
24
  import "@unicom-cloud/utils/class-name";
@@ -26,9 +27,9 @@ import "../chunk/ClqoGc3r.js";
26
27
  import "../chunk/CHQ8c547.js";
27
28
  import "./ColGroup.js";
28
29
  import "./context.js";
29
- import { T as F } from "../chunk/BGb_jT2S.js";
30
+ import { T as G } from "../chunk/CcH9qbbg.js";
30
31
  import "./util.js";
31
32
  import "@unicom-cloud/utils/is";
32
33
  export {
33
- F as default
34
+ G as default
34
35
  };
package/table/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { S as $, T as v } from "../chunk/BGb_jT2S.js";
2
- import { u as ae, a as ie, b as ue, c as ce, d as me, e as fe, f as pe } from "../chunk/BGb_jT2S.js";
1
+ import { S as $, T as v } from "../chunk/CcH9qbbg.js";
2
+ import { u as ae, a as ie, b as ue, c as ce, d as me, e as fe, f as pe } from "../chunk/CcH9qbbg.js";
3
3
  import { defaultComponent as B } from "./constant.js";
4
4
  import x, { useRef as g, useContext as R, useEffect as w, useState as O } from "react";
5
5
  import "../chunk/DsaQZE4X.js";
@@ -8,7 +8,10 @@ export interface PageOptionProps {
8
8
  pageSize?: number;
9
9
  size?: 'mini' | 'small' | 'default' | 'large';
10
10
  selectProps?: Partial<SelectProps>;
11
+ allowCreate?: SelectProps['allowCreate'];
11
12
  }
13
+ declare const SIZE_OPTIONS: number[];
12
14
  declare function PageOption(props: PageOptionProps): import("react/jsx-runtime").JSX.Element;
15
+ export { SIZE_OPTIONS as PAGE_SIZE_OPTIONS };
13
16
  declare const _default: React.MemoExoticComponent<typeof PageOption>;
14
17
  export default _default;
@@ -1,3 +1,5 @@
1
+ import { PAGE_SIZE_OPTIONS } from './PageOption';
1
2
  import Pagination from './Pagination';
3
+ export { PAGE_SIZE_OPTIONS };
2
4
  export default Pagination;
3
5
  export type { PaginationProps } from './interface';
@@ -128,6 +128,11 @@ export interface PaginationProps {
128
128
  * @en Is it possible to change page size
129
129
  */
130
130
  showPageOption?: boolean;
131
+ /**
132
+ * @zh 是否允许通过输入创建新的选项。
133
+ * @en Whether to allow new options to be created by input.
134
+ */
135
+ allowCreate?: SelectProps['allowCreate'];
131
136
  }
132
137
  type itemRenderType = (page: number, type: 'page' | 'more' | 'prev' | 'next', originElement: ReactNode) => ReactNode;
133
138
  export interface PagerProps {
package/version/index.js CHANGED
@@ -1,4 +1,4 @@
1
- const I = "2025-09-15 10:47:41", t = "1757904461041", E = "2.66.5";
1
+ const I = "2025-09-15 15:03:53", t = "1757919833612", E = "2.66.5";
2
2
  export {
3
3
  E as VERSION,
4
4
  I as VERSION_BUILD_DATE,