@blocklet/pages-kit-inner-components 0.4.157 → 0.4.159

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/lib/es/setting.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { jsx as t, jsxs as O, Fragment as X } from "react/jsx-runtime";
2
- import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-BcZbsEn6.js";
2
+ import { t as ye, g as Te, b as ce, E as ot, n as Ke, f as ve } from "./chunks/state-C_CbKF7g.js";
3
3
  import de from "@arcblock/ux/lib/Empty";
4
4
  import { useLocaleContext as C } from "@arcblock/ux/lib/Locale/context";
5
5
  import { CodeEditor as xe } from "@blocklet/code-editor";
@@ -7,12 +7,12 @@ import nt from "@mui/icons-material/AddRounded";
7
7
  import st from "@mui/icons-material/ArrowDownward";
8
8
  import ct from "@mui/icons-material/ArrowUpward";
9
9
  import dt from "@mui/icons-material/DeleteOutline";
10
- import { Typography as M, TextField as V, Stack as R, FormLabel as ie, Box as j, TableContainer as at, Paper as Z, Table as Be, TableHead as Fe, TableRow as le, TableCell as oe, TableBody as Je, Button as E, IconButton as ae, InputAdornment as ge, alpha as ue, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as pe, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
10
+ import { Typography as B, TextField as V, Stack as R, FormLabel as ie, Box as j, TableContainer as at, Paper as Z, Table as Be, TableHead as Fe, TableRow as le, TableCell as oe, TableBody as Je, Button as E, IconButton as ae, InputAdornment as ge, alpha as ue, Tooltip as G, buttonClasses as ut, Dialog as Me, Autocomplete as $e, FormControlLabel as pt, Switch as mt, MenuItem as pe, DialogTitle as ft, DialogContent as ht, DialogActions as bt, Collapse as yt, Divider as vt, Popper as xt } from "@mui/material";
11
11
  import A from "lodash/sortBy";
12
- import { useCallback as D, useMemo as ne, useRef as F, useId as gt, useEffect as $, useState as Q } from "react";
12
+ import { useCallback as D, useMemo as ne, useRef as J, useId as gt, useEffect as $, useState as Q } from "react";
13
13
  import { useUpdate as _e } from "react-use";
14
14
  import { ColorItem as Pt, ConfigColorDialog as wt } from "@blocklet/pages-kit/builtin/color-picker";
15
- import { C as kt } from "./chunks/config-string-CNgatAMw.js";
15
+ import { C as kt } from "./chunks/config-string-SEFT7xVe.js";
16
16
  import Pe from "lodash/isEmpty";
17
17
  import He from "lodash/set";
18
18
  import * as me from "yaml";
@@ -137,7 +137,7 @@ function rr({
137
137
  width: 40,
138
138
  align: "center",
139
139
  renderCell: ({ index: p }) => /* @__PURE__ */ t(
140
- M,
140
+ B,
141
141
  {
142
142
  variant: "body1",
143
143
  sx: {
@@ -305,7 +305,7 @@ function ir({
305
305
  onChange: r,
306
306
  ...i
307
307
  }) {
308
- const l = F(null);
308
+ const l = J(null);
309
309
  return /* @__PURE__ */ O(X, { children: [
310
310
  /* @__PURE__ */ t(
311
311
  kt,
@@ -350,7 +350,7 @@ function lr({
350
350
  PropertyValueField: x,
351
351
  onUpload: g
352
352
  }) {
353
- const { locale: b } = C(), k = F(null);
353
+ const { locale: b } = C(), k = J(null);
354
354
  if (!Pe(l.subProperties)) {
355
355
  const o = A(Object.values(l.subProperties || {}), "index").filter(
356
356
  (n) => n.data.visible !== !1 && n.data.key
@@ -548,7 +548,7 @@ function tt({
548
548
  renderItem: i,
549
549
  ...l
550
550
  }) {
551
- const u = F(null), y = gt(), a = Wt(), x = A(Object.entries(r), (n) => n[1].index).map((n) => n[0]), g = F(x), b = D(
551
+ const u = J(null), y = gt(), a = Wt(), x = A(Object.entries(r), (n) => n[1].index).map((n) => n[0]), g = J(x), b = D(
552
552
  (n) => {
553
553
  g.current = n, a();
554
554
  },
@@ -610,7 +610,7 @@ function nr({
610
610
  itemIndex: y,
611
611
  move: a
612
612
  }) {
613
- const x = F(), [{ isDragging: g }, b, k] = Xt({
613
+ const x = J(), [{ isDragging: g }, b, k] = Xt({
614
614
  type: l,
615
615
  item: () => ({ id: r }),
616
616
  canDrag: () => !e,
@@ -824,7 +824,7 @@ function ar({ value: e }) {
824
824
  }
825
825
  }),
826
826
  /* @__PURE__ */ O(R, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
827
- /* @__PURE__ */ t(M, { variant: "subtitle1", children: r("renderer") }),
827
+ /* @__PURE__ */ t(B, { variant: "subtitle1", children: r("renderer") }),
828
828
  /* @__PURE__ */ O(V, {
829
829
  hiddenLabel: !0,
830
830
  size: "small",
@@ -869,7 +869,7 @@ function ar({ value: e }) {
869
869
  function ur({ config: e }) {
870
870
  const { t: r } = C();
871
871
  return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
872
- /* @__PURE__ */ t(M, { variant: "subtitle1", children: r("basicInfo") }),
872
+ /* @__PURE__ */ t(B, { variant: "subtitle1", children: r("basicInfo") }),
873
873
  /* @__PURE__ */ t(V, {
874
874
  label: r("name"),
875
875
  size: "small",
@@ -904,7 +904,7 @@ function ur({ config: e }) {
904
904
  }
905
905
  function rt({ data: e, params: r, visible: i, config: l, currentLocale: u, defaultLocale: y, allComponents: a, onUpdateConfig: x }) {
906
906
  var k, v, o, n, s, d;
907
- const { t: g } = C(), b = ne(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br : J, [e.type]);
907
+ const { t: g } = C(), b = ne(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? br : M, [e.type]);
908
908
  return /* @__PURE__ */ t(sr, {
909
909
  preview: r.preview,
910
910
  drop: r.drop,
@@ -1049,7 +1049,7 @@ function mr({ config: e, currentLocale: r, defaultLocale: i, allComponents: l, o
1049
1049
  const { t: a } = C(), x = ke({ variant: "dialog" }), g = e.properties && A(Object.values(e.properties), "index");
1050
1050
  return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
1051
1051
  /* @__PURE__ */ O(R, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
1052
- /* @__PURE__ */ t(M, { variant: "subtitle1", children: a("properties") }),
1052
+ /* @__PURE__ */ t(B, { variant: "subtitle1", children: a("properties") }),
1053
1053
  /* @__PURE__ */ t(j, { flex: 1 }),
1054
1054
  y && /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(x), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
1055
1055
  ] }),
@@ -1154,10 +1154,10 @@ function it({ type: e = "properties", component: r, ...i }) {
1154
1154
  return /* @__PURE__ */ O(Me, { ...i, fullWidth: !0, maxWidth: "lg", children: [
1155
1155
  /* @__PURE__ */ t(ft, { children: l("i18nEditorTitle") }),
1156
1156
  /* @__PURE__ */ t(ht, { children: b && /* @__PURE__ */ t(R, { children: /* @__PURE__ */ O(Be, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1157
- /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(le, { children: y.map(({ locale: s, name: d }) => /* @__PURE__ */ O(oe, { children: [
1157
+ /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ t(le, { children: y.map(({ locale: s, name: d }) => /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ O(B, { color: "text.primary", children: [
1158
1158
  d,
1159
- a === s && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12, color: "text.secondary" } })
1160
- ] }, s)) }) }),
1159
+ a === s && /* @__PURE__ */ t(Ut, { sx: { fontSize: 12 } })
1160
+ ] }) }, s)) }) }),
1161
1161
  /* @__PURE__ */ t(Je, { children: A(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ t(le, { children: y.map(({ locale: d }) => {
1162
1162
  var m, w, c, h, f, P, S, p, I, z, N, T, U, W, te, _, H, Y, q, L, Oe, je, Re, ze, Ne, Ve;
1163
1163
  return /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ t(R, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(X, { children: [
@@ -1165,9 +1165,9 @@ function it({ type: e = "properties", component: r, ...i }) {
1165
1165
  size: "small",
1166
1166
  label: "Key",
1167
1167
  value: s.key || "",
1168
- onChange: (B) => {
1168
+ onChange: (F) => {
1169
1169
  g.transact(() => {
1170
- s.key = B.target.value.trim();
1170
+ s.key = F.target.value.trim();
1171
1171
  });
1172
1172
  }
1173
1173
  }),
@@ -1175,14 +1175,14 @@ function it({ type: e = "properties", component: r, ...i }) {
1175
1175
  size: "small",
1176
1176
  label: l("label"),
1177
1177
  value: (((w = (m = s.locales) == null ? void 0 : m[d]) == null ? void 0 : w.name) ?? ((h = (c = s.locales) == null ? void 0 : c[a]) == null ? void 0 : h.name)) || "",
1178
- onChange: (B) => {
1178
+ onChange: (F) => {
1179
1179
  g.transact(() => {
1180
1180
  var K;
1181
- s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].name = B.target.value;
1181
+ s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].name = F.target.value;
1182
1182
  });
1183
1183
  }
1184
1184
  }),
1185
- /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(J, {
1185
+ /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
1186
1186
  allComponents: x,
1187
1187
  defaultLocale: a,
1188
1188
  component: r,
@@ -1192,14 +1192,14 @@ function it({ type: e = "properties", component: r, ...i }) {
1192
1192
  label: "Default Value",
1193
1193
  valueImmutable: se((P = (f = s.locales) == null ? void 0 : f[d]) == null ? void 0 : P.defaultValue),
1194
1194
  value: ((p = (S = s.locales) == null ? void 0 : S[d]) == null ? void 0 : p.defaultValue) ?? ((z = (I = s.locales) == null ? void 0 : I[a]) == null ? void 0 : z.defaultValue),
1195
- onChange: (B) => {
1195
+ onChange: (F) => {
1196
1196
  g.transact(() => {
1197
1197
  var K;
1198
- s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].defaultValue = B;
1198
+ s.locales ?? (s.locales = {}), (K = s.locales)[d] ?? (K[d] = {}), s.locales[d].defaultValue = F;
1199
1199
  });
1200
1200
  }
1201
1201
  }) })
1202
- ] }) : e === "parameters" && k ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(J, {
1202
+ ] }) : e === "parameters" && k ? /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
1203
1203
  allComponents: x,
1204
1204
  defaultLocale: a,
1205
1205
  component: r,
@@ -1208,10 +1208,10 @@ function it({ type: e = "properties", component: r, ...i }) {
1208
1208
  fullWidth: !0,
1209
1209
  valueImmutable: se((W = (U = (T = (N = k.renderer.properties) == null ? void 0 : N[s.id]) == null ? void 0 : T.locales) == null ? void 0 : U[d]) == null ? void 0 : W.value),
1210
1210
  value: ((Y = (H = (_ = (te = k.renderer.properties) == null ? void 0 : te[s.id]) == null ? void 0 : _.locales) == null ? void 0 : H[d]) == null ? void 0 : Y.value) ?? ((je = (Oe = (L = (q = k.renderer.properties) == null ? void 0 : q[s.id]) == null ? void 0 : L.locales) == null ? void 0 : Oe[a]) == null ? void 0 : je.value) ?? ((ze = (Re = s.locales) == null ? void 0 : Re[d]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Ne = s.locales) == null ? void 0 : Ne[a]) == null ? void 0 : Ve.defaultValue),
1211
- onChange: (B) => {
1211
+ onChange: (F) => {
1212
1212
  g.transact(() => {
1213
1213
  var K, Ce, De, Ee, Ae;
1214
- (K = k.renderer).properties ?? (K.properties = {}), (Ce = k.renderer.properties)[De = s.id] ?? (Ce[De] = {}), (Ee = k.renderer.properties[s.id]).locales ?? (Ee.locales = {}), (Ae = k.renderer.properties[s.id].locales)[d] ?? (Ae[d] = {}), k.renderer.properties[s.id].locales[d].value = B;
1214
+ (K = k.renderer).properties ?? (K.properties = {}), (Ce = k.renderer.properties)[De = s.id] ?? (Ce[De] = {}), (Ee = k.renderer.properties[s.id]).locales ?? (Ee.locales = {}), (Ae = k.renderer.properties[s.id].locales)[d] ?? (Ae[d] = {}), k.renderer.properties[s.id].locales[d].value = F;
1215
1215
  });
1216
1216
  }
1217
1217
  }) }) : null }, s.id) }, d);
@@ -1243,7 +1243,7 @@ const We = (e, r) => (i) => {
1243
1243
  };
1244
1244
  };
1245
1245
  function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
1246
- const { t: u, locale: y } = C(), a = F(null), x = pr(a, e), g = D(() => {
1246
+ const { t: u, locale: y } = C(), a = J(null), x = pr(a, e), g = D(() => {
1247
1247
  if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
1248
1248
  try {
1249
1249
  let b = {};
@@ -1271,7 +1271,7 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
1271
1271
  }
1272
1272
  }, [e, y, i, r]);
1273
1273
  return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(R, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: a, children: [
1274
- /* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(M, { variant: "caption", color: "text.secondary", children: u("maker.properties.subProperties") }) }),
1274
+ /* @__PURE__ */ t(vt, { sx: { mt: -1 }, children: /* @__PURE__ */ t(B, { variant: "caption", color: "text.secondary", children: u("maker.properties.subProperties") }) }),
1275
1275
  e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ t(tt, {
1276
1276
  component: R,
1277
1277
  gap: 2,
@@ -1359,9 +1359,9 @@ function br({ property: e, onChange: r, defaultLocale: i, allComponents: l }) {
1359
1359
  })
1360
1360
  ] });
1361
1361
  }
1362
- function J({ component: e, property: r, value: i, onChange: l, valueImmutable: u, defaultLocale: y, allComponents: a, ...x }) {
1362
+ function M({ component: e, property: r, value: i, onChange: l, valueImmutable: u, defaultLocale: y, allComponents: a, ...x }) {
1363
1363
  var n, s, d, m, w;
1364
- const { locale: g } = C(), b = It(), k = F(null), v = () => {
1364
+ const { locale: g } = C(), b = It(), k = J(null), v = () => {
1365
1365
  var h;
1366
1366
  const c = (h = b == null ? void 0 : b.current) == null ? void 0 : h.getUploader();
1367
1367
  c == null || c.open(), k.current && c.onceUploadSuccess(({ response: f }) => {
@@ -1422,7 +1422,7 @@ function J({ component: e, property: r, value: i, onChange: l, valueImmutable: u
1422
1422
  component: e,
1423
1423
  defaultLocale: y,
1424
1424
  allComponents: a,
1425
- PropertyValueField: J,
1425
+ PropertyValueField: M,
1426
1426
  onUpload: (c) => {
1427
1427
  k.current = c, v();
1428
1428
  }
@@ -1501,7 +1501,7 @@ function J({ component: e, property: r, value: i, onChange: l, valueImmutable: u
1501
1501
  value: Array.isArray(i) ? i : [],
1502
1502
  onChange: (c) => l == null ? void 0 : l(c),
1503
1503
  property: r,
1504
- renderItem: ({ item: c, index: h, onChange: f }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(R, { gap: 1, width: "100%", children: A(Object.values(r.subProperties), "index").filter((P) => P.data.visible !== !1).map(({ data: P }) => P.key ? /* @__PURE__ */ t(J, {
1504
+ renderItem: ({ item: c, index: h, onChange: f }) => r.subProperties && Object.keys(r.subProperties).length > 0 ? /* @__PURE__ */ t(R, { gap: 1, width: "100%", children: A(Object.values(r.subProperties), "index").filter((P) => P.data.visible !== !1).map(({ data: P }) => P.key ? /* @__PURE__ */ t(M, {
1505
1505
  component: e,
1506
1506
  property: P,
1507
1507
  value: c[P.key],
@@ -1562,12 +1562,12 @@ function Pr({ value: e }) {
1562
1562
  }),
1563
1563
  g && /* @__PURE__ */ O(X, { children: [
1564
1564
  /* @__PURE__ */ O(R, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1565
- /* @__PURE__ */ t(M, { variant: "subtitle2", children: r("parameters") }),
1565
+ /* @__PURE__ */ t(B, { variant: "subtitle2", children: r("parameters") }),
1566
1566
  /* @__PURE__ */ t(E, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(b), children: /* @__PURE__ */ t(Le, { fontSize: "small" }) })
1567
1567
  ] }),
1568
1568
  g.properties && A(Object.values(g.properties), "index").map(({ data: n }) => {
1569
1569
  var s, d, m, w, c, h, f, P, S, p, I, z, N, T, U, W;
1570
- return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(J, {
1570
+ return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
1571
1571
  allComponents: x,
1572
1572
  defaultLocale: u,
1573
1573
  component: g,
@@ -1647,11 +1647,11 @@ function lt({ config: e, allComponents: r, defaultLocale: i, propertiesValue: l,
1647
1647
  };
1648
1648
  }, [JSON.stringify(g)]), s = o(), d = _t(s, "key");
1649
1649
  return /* @__PURE__ */ t(we, { children: /* @__PURE__ */ O(R, { gap: 2, children: [
1650
- /* @__PURE__ */ t(M, { variant: "subtitle1", children: x("maker.properties.parameters") }),
1650
+ /* @__PURE__ */ t(B, { variant: "subtitle1", children: x("maker.properties.parameters") }),
1651
1651
  !e || n.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ t(de, { style: { fontSize: 12 }, children: x("maker.properties.noParameters") }) : /* @__PURE__ */ O(X, { children: [
1652
1652
  /* @__PURE__ */ t(R, { gap: 2, children: n.visibleProperties.map(({ data: m }) => {
1653
1653
  var w, c;
1654
- return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(J, {
1654
+ return /* @__PURE__ */ t(j, { children: /* @__PURE__ */ t(M, {
1655
1655
  allComponents: r,
1656
1656
  defaultLocale: i,
1657
1657
  size: "small",
@@ -1724,5 +1724,5 @@ export {
1724
1724
  xr as DefaultWebComponentScriptTemplate,
1725
1725
  lt as ParametersConfig,
1726
1726
  mr as PropertiesConfig,
1727
- J as PropertyValueField
1727
+ M as PropertyValueField
1728
1728
  };