@gisce/react-ooui 2.111.0-alpha.2 → 2.111.0-alpha.4

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.
@@ -1103,51 +1103,53 @@ function rl(t, e) {
1103
1103
  window.open(a);
1104
1104
  }
1105
1105
  const As = (t) => {
1106
- const { value: e, style: n = {} } = t;
1106
+ const { value: e, style: n = {}, width: r, height: o } = t;
1107
1107
  if (e) {
1108
- const r = Mt(e);
1109
- return r ? /* @__PURE__ */ s(r, {}) : /* @__PURE__ */ s(
1110
- "img",
1111
- {
1112
- src: `data:image/*;base64,${e}`,
1113
- style: { maxWidth: "100px", ...n }
1114
- }
1108
+ const i = o || r, c = Mt(
1109
+ e,
1110
+ i ? { style: i ? { fontSize: i } : {} } : void 0
1115
1111
  );
1112
+ if (c)
1113
+ return /* @__PURE__ */ s(c, {});
1114
+ {
1115
+ const l = { ...n };
1116
+ return r && o ? (l.width = `${r}px`, l.height = `${o}px`) : r ? (l.width = `${r}px`, l.height = "auto") : o ? (l.height = `${o}px`, l.width = "auto") : l.maxWidth = "100px", /* @__PURE__ */ s("img", { src: `data:image/*;base64,${e}`, style: l });
1117
+ }
1116
1118
  }
1117
1119
  }, gf = (t) => {
1118
- const { ooui: e } = t, { required: n, id: r } = e;
1119
- return Mt(r) ? /* @__PURE__ */ s(As, { value: r }) : /* @__PURE__ */ s(Ye, { required: n, ...t, children: /* @__PURE__ */ s(yf, { ooui: e }) });
1120
+ const { ooui: e } = t, { required: n, id: r, width: o, height: i } = e;
1121
+ return Mt(r) ? /* @__PURE__ */ s(As, { value: r, width: o, height: i }) : /* @__PURE__ */ s(Ye, { required: n, ...t, children: /* @__PURE__ */ s(yf, { ooui: e }) });
1120
1122
  }, yf = (t) => {
1121
- const { ooui: e, value: n, onChange: r } = t, { readOnly: o } = e, i = z(null), { t: a } = xe(), c = (u) => {
1122
- r == null || r(u);
1123
+ const { ooui: e, value: n, onChange: r } = t, { readOnly: o, width: i, height: a } = e, c = z(null), { t: l } = xe(), d = (m) => {
1124
+ r == null || r(m);
1123
1125
  };
1124
- async function l() {
1125
- const u = await Qn(n), p = `data:${u == null ? void 0 : u.mime};base64,${n}`, m = document.createElement("a");
1126
- m.href = p, m.download = `image.${u == null ? void 0 : u.ext}`, m.click();
1126
+ async function f() {
1127
+ const m = await Qn(n), g = `data:${m == null ? void 0 : m.mime};base64,${n}`, h = document.createElement("a");
1128
+ h.href = g, h.download = `image.${m == null ? void 0 : m.ext}`, h.click();
1127
1129
  }
1128
- async function d(u) {
1129
- u.stopPropagation(), u.preventDefault();
1130
- const p = u.target.files[0], m = await tl(p);
1131
- c(m);
1130
+ async function u(m) {
1131
+ m.stopPropagation(), m.preventDefault();
1132
+ const g = m.target.files[0], h = await tl(g);
1133
+ d(h);
1132
1134
  }
1133
- function f() {
1134
- c(void 0);
1135
+ function p() {
1136
+ d(void 0);
1135
1137
  }
1136
1138
  return /* @__PURE__ */ j(we, { children: [
1137
1139
  /* @__PURE__ */ j(Ze, { gutter: 8, wrap: !1, justify: "center", children: [
1138
1140
  Q(
1139
- () => /* @__PURE__ */ s(As, { value: n }),
1140
- [n]
1141
+ () => /* @__PURE__ */ s(As, { value: n, width: i, height: a }),
1142
+ [n, i, a]
1141
1143
  ),
1142
1144
  /* @__PURE__ */ s(
1143
1145
  "input",
1144
1146
  {
1145
1147
  type: "file",
1146
1148
  id: "file",
1147
- ref: i,
1149
+ ref: c,
1148
1150
  accept: "image/*",
1149
1151
  style: { display: "none" },
1150
- onChange: d
1152
+ onChange: u
1151
1153
  }
1152
1154
  )
1153
1155
  ] }),
@@ -1155,29 +1157,29 @@ const As = (t) => {
1155
1157
  /* @__PURE__ */ s(
1156
1158
  St,
1157
1159
  {
1158
- tooltip: a("uploadNewImage"),
1160
+ tooltip: l("uploadNewImage"),
1159
1161
  icon: /* @__PURE__ */ s(gs, {}),
1160
1162
  disabled: o,
1161
1163
  onClick: () => {
1162
- i.current.click();
1164
+ c.current.click();
1163
1165
  }
1164
1166
  }
1165
1167
  ),
1166
1168
  /* @__PURE__ */ s(
1167
1169
  St,
1168
1170
  {
1169
- tooltip: a("download"),
1171
+ tooltip: l("download"),
1170
1172
  disabled: !n,
1171
- onClick: l,
1173
+ onClick: f,
1172
1174
  icon: /* @__PURE__ */ s(ys, {})
1173
1175
  }
1174
1176
  ),
1175
1177
  /* @__PURE__ */ s(
1176
1178
  St,
1177
1179
  {
1178
- tooltip: a("clear"),
1180
+ tooltip: l("clear"),
1179
1181
  disabled: o || !n,
1180
- onClick: f,
1182
+ onClick: p,
1181
1183
  icon: /* @__PURE__ */ s(ir, {})
1182
1184
  }
1183
1185
  )