reykit 1.0.262 → 1.0.264

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.js CHANGED
@@ -50923,6 +50923,13 @@ function nw(a, r = "asc", u) {
50923
50923
  )
50924
50924
  );
50925
50925
  }
50926
+ function RY(a) {
50927
+ const r = /* @__PURE__ */ new Set();
50928
+ return a.filter((c) => {
50929
+ const p = typeof c == "object" && c !== null && "id" in c ? c.id : c;
50930
+ return r.has(p) ? !1 : (r.add(p), !0);
50931
+ });
50932
+ }
50926
50933
  function k4(a) {
50927
50934
  const r = /* @__PURE__ */ new Map();
50928
50935
  for (const u of a)
@@ -50932,29 +50939,30 @@ function k4(a) {
50932
50939
  );
50933
50940
  return r;
50934
50941
  }
50935
- const RY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50942
+ const TY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
50936
50943
  __proto__: null,
50937
50944
  compare: L4,
50938
50945
  countArr: k4,
50939
50946
  range: ew,
50940
50947
  rangeArr: tw,
50941
50948
  sort: nw,
50942
- toggleArr: EY
50949
+ toggleArr: EY,
50950
+ unique: RY
50943
50951
  }, Symbol.toStringTag, { value: "Module" }));
50944
- function TY({
50952
+ function CY({
50945
50953
  data: a,
50946
50954
  setData: r,
50947
50955
  fieldOption: u,
50948
- searchOption: c,
50949
- buttonOption: p,
50950
- rowOption: h,
50951
- selectRowsOption: y,
50952
- pageSize: b = 20,
50953
- mobilePageSize: C = 10,
50954
- language: T,
50955
- defaultFieldOption: R
50956
+ defaultFieldOption: c,
50957
+ searchOption: p,
50958
+ buttonOption: h,
50959
+ rowOption: y,
50960
+ selectRowsOption: b,
50961
+ pageSize: C = 20,
50962
+ mobilePageSize: T = 10,
50963
+ language: R
50956
50964
  }) {
50957
- const M = j0(C, b), [O, A] = En(M), [N, z] = En(1), [D, U] = En(
50965
+ const M = j0(T, C), [O, A] = En(M), [N, z] = En(1), [D, U] = En(
50958
50966
  (u ?? Array.from(
50959
50967
  new Set(
50960
50968
  a.flatMap((X) => Object.keys(X))
@@ -50963,13 +50971,13 @@ function TY({
50963
50971
  key: X,
50964
50972
  name: X
50965
50973
  }))).map((X) => ({
50966
- ...R || {},
50974
+ ...c || {},
50967
50975
  ...X
50968
50976
  }))
50969
- ), [_, j] = En(""), [H, G] = En({}), k = a.filter((X) => (_ === "" || c === void 0 || c.method(_, X)) && Object.entries(X).every(
50977
+ ), [_, j] = En(""), [H, G] = En({}), k = a.filter((X) => (_ === "" || p === void 0 || p.method(_, X)) && Object.entries(X).every(
50970
50978
  ([ee, te]) => !H[ee] || H[ee].length === 0 ? !0 : Array.isArray(te) ? te.some((W) => H[ee]?.includes(W)) : H[ee]?.includes(te)
50971
- )), Q = k.slice((N - 1) * O, N * O), [K, J] = En(y && []);
50972
- return T = T ?? yx(), vi(() => {
50979
+ )), Q = k.slice((N - 1) * O, N * O), [K, J] = En(b && []);
50980
+ return R = R ?? yx(), vi(() => {
50973
50981
  u || U(
50974
50982
  Array.from(
50975
50983
  new Set(
@@ -50978,12 +50986,12 @@ function TY({
50978
50986
  ).map((X) => ({
50979
50987
  key: X,
50980
50988
  name: X,
50981
- ...R || {}
50989
+ ...c || {}
50982
50990
  }))
50983
50991
  );
50984
50992
  }, [a]), /* @__PURE__ */ g.jsxs("div", { className: "relative flex flex-col gap-4 size-full", children: [
50985
50993
  /* @__PURE__ */ g.jsx(
50986
- CY,
50994
+ wY,
50987
50995
  {
50988
50996
  data: a,
50989
50997
  setPage: z,
@@ -50991,29 +50999,29 @@ function TY({
50991
50999
  setFieldOption: U,
50992
51000
  searchValue: _,
50993
51001
  setSearchValue: j,
50994
- searchOption: c,
50995
- buttonOption: p,
50996
- selectRowsOption: y,
51002
+ searchOption: p,
51003
+ buttonOption: h,
51004
+ selectRowsOption: b,
50997
51005
  selectRows: K,
50998
51006
  groupFilter: H,
50999
51007
  setGroupFilter: G,
51000
- language: T
51008
+ language: R
51001
51009
  }
51002
51010
  ),
51003
51011
  /* @__PURE__ */ g.jsx(
51004
- wY,
51012
+ NY,
51005
51013
  {
51006
51014
  pageData: Q,
51007
51015
  setData: r,
51008
51016
  fieldOption: D,
51009
51017
  selectRows: K,
51010
51018
  setSelectRows: J,
51011
- rowOption: h,
51012
- language: T
51019
+ rowOption: y,
51020
+ language: R
51013
51021
  }
51014
51022
  ),
51015
51023
  /* @__PURE__ */ g.jsx(
51016
- NY,
51024
+ OY,
51017
51025
  {
51018
51026
  total: k.length,
51019
51027
  pageSize: O,
@@ -51021,12 +51029,12 @@ function TY({
51021
51029
  page: N,
51022
51030
  setPage: z,
51023
51031
  selectRows: K,
51024
- language: T
51032
+ language: R
51025
51033
  }
51026
51034
  )
51027
51035
  ] });
51028
51036
  }
51029
- function CY({
51037
+ function wY({
51030
51038
  data: a,
51031
51039
  setPage: r,
51032
51040
  fieldOption: u,
@@ -51423,7 +51431,7 @@ function CY({
51423
51431
  ] })
51424
51432
  ] });
51425
51433
  }
51426
- function wY({
51434
+ function NY({
51427
51435
  pageData: a,
51428
51436
  setData: r,
51429
51437
  fieldOption: u,
@@ -51598,7 +51606,7 @@ function wY({
51598
51606
  )) })
51599
51607
  ] }) });
51600
51608
  }
51601
- function NY({
51609
+ function OY({
51602
51610
  total: a,
51603
51611
  pageSize: r,
51604
51612
  setPageSize: u,
@@ -51756,7 +51764,7 @@ function aw(a, r = !1) {
51756
51764
  }
51757
51765
  return z0(a) ? a : a instanceof Date ? a.toLocaleString() : a == null ? "" : typeof a == "object" ? JSON.stringify(a) : String(a);
51758
51766
  }
51759
- function OY({
51767
+ function MY({
51760
51768
  icon: a,
51761
51769
  text: r,
51762
51770
  url: u,
@@ -51779,7 +51787,7 @@ function OY({
51779
51787
  }
51780
51788
  ) : C });
51781
51789
  }
51782
- function MY({
51790
+ function AY({
51783
51791
  ...a
51784
51792
  }) {
51785
51793
  return /* @__PURE__ */ g.jsx(
@@ -51816,7 +51824,7 @@ function MY({
51816
51824
  }
51817
51825
  );
51818
51826
  }
51819
- function AY({
51827
+ function DY({
51820
51828
  openIcon: a,
51821
51829
  closeIcon: r,
51822
51830
  tooltip: u,
@@ -51871,21 +51879,21 @@ function AY({
51871
51879
  /* @__PURE__ */ g.jsx(MR, { side: p, children: z ? c : u })
51872
51880
  ] }) : U;
51873
51881
  }
51874
- const DY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51882
+ const zY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
51875
51883
  __proto__: null,
51876
51884
  Breadcrumb: gY,
51877
51885
  CarouselMedia: xY,
51878
51886
  CycleButton: vY,
51879
51887
  Form: bY,
51880
- IconText: OY,
51881
- IconToggle: AY,
51888
+ IconText: MY,
51889
+ IconToggle: DY,
51882
51890
  Loading: WI,
51883
- MarkdownText: MY,
51891
+ MarkdownText: AY,
51884
51892
  Notice: SY,
51885
51893
  PopupImage: V4,
51886
51894
  PopupVideo: H4,
51887
51895
  ScrollToTopButton: yY,
51888
- Table: TY,
51896
+ Table: CY,
51889
51897
  TextBadges: U4,
51890
51898
  Video: B4,
51891
51899
  createCover: b4,
@@ -52168,10 +52176,10 @@ const Lg = {
52168
52176
  appId: null,
52169
52177
  onError: null
52170
52178
  };
52171
- function zY(a, r = null) {
52179
+ function jY(a, r = null) {
52172
52180
  Lg.appId = a, Lg.onError = r;
52173
52181
  }
52174
- function jY(a, ...r) {
52182
+ function _Y(a, ...r) {
52175
52183
  if (Lg.appId === null) throw new Error('not configured with function "initAliGraphCaptcha"');
52176
52184
  const u = {
52177
52185
  captchaId: Lg.appId,
@@ -52188,15 +52196,15 @@ function jY(a, ...r) {
52188
52196
  }
52189
52197
  );
52190
52198
  }
52191
- const _Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52199
+ const UY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52192
52200
  __proto__: null,
52193
- initAliGraphCaptcha: zY,
52194
- verifyAliGraphCaptcha: jY
52201
+ initAliGraphCaptcha: jY,
52202
+ verifyAliGraphCaptcha: _Y
52195
52203
  }, Symbol.toStringTag, { value: "Module" }));
52196
- function UY() {
52204
+ function VY() {
52197
52205
  document.documentElement.classList.add("debug");
52198
52206
  }
52199
- function VY(a) {
52207
+ function HY(a) {
52200
52208
  try {
52201
52209
  const r = new URL(a);
52202
52210
  return r.protocol === "http:" || r.protocol === "https:";
@@ -52204,12 +52212,12 @@ function VY(a) {
52204
52212
  return !1;
52205
52213
  }
52206
52214
  }
52207
- const HY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52215
+ const BY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52208
52216
  __proto__: null,
52209
- debugCss: UY,
52210
- isUrl: VY
52217
+ debugCss: VY,
52218
+ isUrl: HY
52211
52219
  }, Symbol.toStringTag, { value: "Module" }));
52212
- class BY {
52220
+ class LY {
52213
52221
  /**
52214
52222
  * Build instance.
52215
52223
  *
@@ -52310,9 +52318,9 @@ function Y4(a, r) {
52310
52318
  const u = a instanceof Blob ? window.URL.createObjectURL(a) : a, c = document.createElement("a");
52311
52319
  c.download = r, c.href = u, c.style.display = "none", document.body.appendChild(c), c.click(), c.remove(), a instanceof Blob && URL.revokeObjectURL(u);
52312
52320
  }
52313
- const LY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52321
+ const kY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52314
52322
  __proto__: null,
52315
- Storager: BY,
52323
+ Storager: LY,
52316
52324
  downloadFile: Y4,
52317
52325
  openFile: I4
52318
52326
  }, Symbol.toStringTag, { value: "Module" }));
@@ -52320,15 +52328,15 @@ async function jR(a, r) {
52320
52328
  const u = r && r.width, c = (r && r.margin) ?? 0;
52321
52329
  return await l8.toDataURL(a, { width: u, margin: c });
52322
52330
  }
52323
- async function kY(a, r) {
52331
+ async function IY(a, r) {
52324
52332
  const u = await jR(a, r), p = await (await fetch(u)).blob();
52325
52333
  return I4(p), u;
52326
52334
  }
52327
- async function IY(a, r) {
52335
+ async function YY(a, r) {
52328
52336
  const u = await jR(a, r), c = (r && r.fileName) ?? "qrcode.png", h = await (await fetch(u)).blob();
52329
52337
  return Y4(h, c), u;
52330
52338
  }
52331
- async function YY(a, r, u) {
52339
+ async function PY(a, r, u) {
52332
52340
  const c = await jR(a, u);
52333
52341
  if (typeof r == "string") {
52334
52342
  const p = document.getElementById(r);
@@ -52337,14 +52345,14 @@ async function YY(a, r, u) {
52337
52345
  }
52338
52346
  return r.setAttribute("src", c), c;
52339
52347
  }
52340
- const PY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52348
+ const GY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52341
52349
  __proto__: null,
52342
- downloadQrcode: IY,
52350
+ downloadQrcode: YY,
52343
52351
  getQrcode: jR,
52344
- openQrcode: kY,
52345
- setQrcode: YY
52352
+ openQrcode: IY,
52353
+ setQrcode: PY
52346
52354
  }, Symbol.toStringTag, { value: "Module" }));
52347
- async function GY(a, r) {
52355
+ async function qY(a, r) {
52348
52356
  let {
52349
52357
  params: u,
52350
52358
  body: c,
@@ -52379,23 +52387,23 @@ async function GY(a, r) {
52379
52387
  }
52380
52388
  return C;
52381
52389
  }
52382
- const qY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52390
+ const XY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52383
52391
  __proto__: null,
52384
- request: GY
52392
+ request: qY
52385
52393
  }, Symbol.toStringTag, { value: "Module" })), P4 = `
52386
- \r\v\f`, G4 = "abcdefghijklmnopqrstuvwxyz", q4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", kg = G4 + q4, am = "0123456789", XY = am + "abcdefABCDEF", QY = "01234567", Ig = "!\"#$%&'()*+,-./:;<=>?@[]^_`{|}~", ZY = am + kg + Ig + P4, $Y = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52394
+ \r\v\f`, G4 = "abcdefghijklmnopqrstuvwxyz", q4 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ", kg = G4 + q4, am = "0123456789", QY = am + "abcdefABCDEF", ZY = "01234567", Ig = "!\"#$%&'()*+,-./:;<=>?@[]^_`{|}~", $Y = am + kg + Ig + P4, KY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52387
52395
  __proto__: null,
52388
52396
  asciiLetters: kg,
52389
52397
  asciiLowercase: G4,
52390
52398
  asciiUppercase: q4,
52391
52399
  digits: am,
52392
- hexdigits: XY,
52393
- octdigits: QY,
52394
- printable: ZY,
52400
+ hexdigits: QY,
52401
+ octdigits: ZY,
52402
+ printable: $Y,
52395
52403
  punctuation: Ig,
52396
52404
  whitespace: P4
52397
52405
  }, Symbol.toStringTag, { value: "Module" }));
52398
- function KY(a = 32, r = "dlp") {
52406
+ function FY(a = 32, r = "dlp") {
52399
52407
  let u;
52400
52408
  switch (r) {
52401
52409
  case "d":
@@ -52427,56 +52435,56 @@ function KY(a = 32, r = "dlp") {
52427
52435
  }
52428
52436
  return c.join("");
52429
52437
  }
52430
- const FY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52438
+ const JY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52431
52439
  __proto__: null,
52432
- randChar: KY
52433
- }, Symbol.toStringTag, { value: "Module" })), JY = /^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, WY = /^https?:\/\/[^\s/$.?#].[^\s]*$/, eP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/, tP = /^1[3-9]\d{9}$/, nP = /^[\u4e00-\u9fa5]+$/, aP = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52440
+ randChar: FY
52441
+ }, Symbol.toStringTag, { value: "Module" })), WY = /^((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/, eP = /^https?:\/\/[^\s/$.?#].[^\s]*$/, tP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/, nP = /^1[3-9]\d{9}$/, aP = /^[\u4e00-\u9fa5]+$/, oP = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52434
52442
  __proto__: null,
52435
- PATTERN_CN: nP,
52436
- PATTERN_EMAIL: eP,
52437
- PATTERN_IP: JY,
52438
- PATTERN_PHONE: tP,
52439
- PATTERN_URL: WY
52443
+ PATTERN_CN: aP,
52444
+ PATTERN_EMAIL: tP,
52445
+ PATTERN_IP: WY,
52446
+ PATTERN_PHONE: nP,
52447
+ PATTERN_URL: eP
52440
52448
  }, Symbol.toStringTag, { value: "Module" }));
52441
- function oP() {
52449
+ function lP() {
52442
52450
  const a = /* @__PURE__ */ new Date();
52443
52451
  return a.getFullYear() + "-" + String(a.getMonth() + 1).padStart(2, "0") + "-" + String(a.getDate()).padStart(2, "0") + "T" + String(a.getHours()).padStart(2, "0") + ":" + String(a.getMinutes()).padStart(2, "0");
52444
52452
  }
52445
- const lP = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52453
+ const rP = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
52446
52454
  __proto__: null,
52447
- datetimeLocal: oP
52448
- }, Symbol.toStringTag, { value: "Module" })), TP = {
52449
- component: DY,
52455
+ datetimeLocal: lP
52456
+ }, Symbol.toStringTag, { value: "Module" })), CP = {
52457
+ component: zY,
52450
52458
  ui: _4,
52451
52459
  icon: x4,
52452
- captcha: _Y,
52453
- base: HY,
52454
- data: RY,
52455
- image: PY,
52456
- net: qY,
52457
- rand: FY,
52458
- re: aP,
52460
+ captcha: UY,
52461
+ base: BY,
52462
+ data: TY,
52463
+ image: GY,
52464
+ net: XY,
52465
+ rand: JY,
52466
+ re: oP,
52459
52467
  react: x8,
52460
- text: $Y,
52461
- time: lP,
52468
+ text: KY,
52469
+ time: rP,
52462
52470
  twc: K8,
52463
- window: LY
52471
+ window: kY
52464
52472
  };
52465
52473
  export {
52466
- HY as base,
52467
- _Y as captcha,
52468
- DY as component,
52469
- RY as data,
52470
- TP as default,
52474
+ BY as base,
52475
+ UY as captcha,
52476
+ zY as component,
52477
+ TY as data,
52478
+ CP as default,
52471
52479
  x4 as icon,
52472
- PY as image,
52473
- qY as net,
52474
- FY as rand,
52475
- aP as re,
52480
+ GY as image,
52481
+ XY as net,
52482
+ JY as rand,
52483
+ oP as re,
52476
52484
  x8 as react,
52477
- $Y as text,
52478
- lP as time,
52485
+ KY as text,
52486
+ rP as time,
52479
52487
  K8 as twc,
52480
52488
  _4 as ui,
52481
- LY as window
52489
+ kY as window
52482
52490
  };
@@ -66,6 +66,7 @@ type TableSelectRowsOption<Row extends Record<string, any>> = {
66
66
  * - `Attribute isGroupSearch` : Whether show search input in group button.
67
67
  * - `Attribute sortMethod` : Sort method.
68
68
  * - `Attribute defaultValue` : Replace none value.
69
+ * @param defaultFieldOption - Default field option.
69
70
  * @param searchOption - Search option.
70
71
  * - `Attribute method` : Search method.
71
72
  * - `Attribute placeholder` : Search input placeholder.
@@ -81,12 +82,12 @@ type TableSelectRowsOption<Row extends Record<string, any>> = {
81
82
  * @param pageSize - Page rows size.
82
83
  * @param mobilePageSize - Page rows size on mobile devices.
83
84
  * @param language - Language type.
84
- * @param defaultFieldOption - Default field option.
85
85
  */
86
- declare function Table<Row extends Record<string, any>>({ data, setData, fieldOption, searchOption, buttonOption, rowOption, selectRowsOption, pageSize, mobilePageSize, language, defaultFieldOption, }: {
86
+ declare function Table<Row extends Record<string, any>>({ data, setData, fieldOption, defaultFieldOption, searchOption, buttonOption, rowOption, selectRowsOption, pageSize, mobilePageSize, language }: {
87
87
  data: Row[];
88
88
  setData: (value: Row[] | ((value: Row[]) => Row[])) => void;
89
89
  fieldOption?: TableFieldOption<Row>;
90
+ defaultFieldOption?: DefaultTableFieldOption;
90
91
  searchOption?: TableSearchOption<Row>;
91
92
  buttonOption?: TableButtonOption;
92
93
  rowOption?: TableRowOption<Row>;
@@ -94,5 +95,4 @@ declare function Table<Row extends Record<string, any>>({ data, setData, fieldOp
94
95
  pageSize?: number;
95
96
  mobilePageSize?: number;
96
97
  language?: 'en' | 'zh';
97
- defaultFieldOption?: DefaultTableFieldOption;
98
98
  }): import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,7 @@
4
4
  * @Contact : reyxbo@163.com
5
5
  * @Explain : Data processing module.
6
6
  */
7
- export { range, rangeArr, toggleArr, compare, sort, countArr };
7
+ export { range, rangeArr, toggleArr, compare, sort, unique, countArr };
8
8
  declare function range(stop: number): Generator<number>;
9
9
  declare function range(start: number, stop: number, step?: number): Generator<number>;
10
10
  declare function rangeArr(stop: number): number[];
@@ -35,6 +35,13 @@ declare function compare(a: any, b: any, order?: 'asc' | 'desc'): 1 | 0 | -1;
35
35
  * @returns Sorted array.
36
36
  */
37
37
  declare function sort<T>(arr: T[], order?: 'asc' | 'desc', key?: keyof T): T[];
38
+ /**
39
+ * De duplication of array.
40
+ *
41
+ * @param array - Array data.
42
+ * @returns Array data after de duplication.
43
+ */
44
+ declare function unique<T>(array: T[]): T[];
38
45
  /**
39
46
  * Count elements of array.
40
47
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reykit",
3
- "version": "1.0.262",
3
+ "version": "1.0.264",
4
4
  "description": "General-purpose JavaScript utility method package.",
5
5
  "author": "reyxbo",
6
6
  "keywords": [