@1urso/generic-editor 0.1.20 → 0.1.21

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/README.md CHANGED
@@ -95,6 +95,7 @@ The editor offers an experience similar to design tools like Canva or Figma:
95
95
  - **Conditional Formatting**:
96
96
  - Define rules to change the element's style based on data values.
97
97
  - _Example_: If `price` is greater than `100`, set text color to `red`.
98
+ - _Action_: Choose between applying styles (Color, Bold, Background, etc.) or **Hiding the Element** completely.
98
99
  - Supports multiple rules with operators like Equals, Not Equals, Contains, Greater Than, Less Than, Truthy, and Falsy.
99
100
 
100
101
  ### Settings and Test Data
@@ -9176,75 +9176,110 @@ var FormattingSettings = ({ element: n, updateElement: s }) => {
9176
9176
  })]
9177
9177
  })]
9178
9178
  }),
9179
+ /* @__PURE__ */ jsx(p, {
9180
+ gap: "2",
9181
+ children: /* @__PURE__ */ jsxs(p$1, {
9182
+ flexGrow: "1",
9183
+ children: [/* @__PURE__ */ jsx(p$2, {
9184
+ size: "1",
9185
+ mb: "1",
9186
+ as: "div",
9187
+ children: "Ação"
9188
+ }), /* @__PURE__ */ jsxs("select", {
9189
+ value: K.style.display === "none" ? "hide" : "style",
9190
+ onChange: (n) => {
9191
+ n.target.value === "hide" ? U(K.id, { display: "none" }) : U(K.id, { display: void 0 });
9192
+ },
9193
+ style: {
9194
+ width: "100%",
9195
+ padding: "6px",
9196
+ borderRadius: "4px",
9197
+ border: "1px solid var(--gray-6)",
9198
+ backgroundColor: "var(--color-panel-solid)",
9199
+ color: "var(--gray-12)",
9200
+ fontSize: "14px"
9201
+ },
9202
+ children: [/* @__PURE__ */ jsx("option", {
9203
+ value: "style",
9204
+ children: "Aplicar Estilo"
9205
+ }), /* @__PURE__ */ jsx("option", {
9206
+ value: "hide",
9207
+ children: "Ocultar Elemento"
9208
+ })]
9209
+ })]
9210
+ })
9211
+ }),
9179
9212
  /* @__PURE__ */ jsx(o$3, {
9180
9213
  size: "4",
9181
9214
  my: "2"
9182
9215
  }),
9183
- /* @__PURE__ */ jsx(p$2, {
9184
- size: "2",
9185
- weight: "bold",
9186
- children: "Aplicar Estilos"
9187
- }),
9188
- /* @__PURE__ */ jsxs(o$2, {
9189
- columns: "2",
9190
- gap: "3",
9191
- children: [/* @__PURE__ */ jsxs(p$1, { children: [/* @__PURE__ */ jsx(p$2, {
9192
- size: "1",
9193
- mb: "1",
9194
- as: "div",
9195
- children: "Cor do Texto"
9196
- }), /* @__PURE__ */ jsx("input", {
9197
- type: "color",
9198
- value: K.style.color || "#000000",
9199
- onChange: (n) => U(K.id, { color: n.target.value }),
9200
- style: {
9201
- width: "100%",
9202
- height: 32
9203
- }
9204
- })] }), /* @__PURE__ */ jsxs(p$1, { children: [/* @__PURE__ */ jsx(p$2, {
9205
- size: "1",
9206
- mb: "1",
9207
- as: "div",
9208
- children: "Cor de Fundo"
9209
- }), /* @__PURE__ */ jsxs(p, {
9210
- gap: "2",
9211
- children: [/* @__PURE__ */ jsx("input", {
9216
+ K.style.display !== "none" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
9217
+ /* @__PURE__ */ jsx(p$2, {
9218
+ size: "2",
9219
+ weight: "bold",
9220
+ children: "Aplicar Estilos"
9221
+ }),
9222
+ /* @__PURE__ */ jsxs(o$2, {
9223
+ columns: "2",
9224
+ gap: "3",
9225
+ children: [/* @__PURE__ */ jsxs(p$1, { children: [/* @__PURE__ */ jsx(p$2, {
9226
+ size: "1",
9227
+ mb: "1",
9228
+ as: "div",
9229
+ children: "Cor do Texto"
9230
+ }), /* @__PURE__ */ jsx("input", {
9212
9231
  type: "color",
9213
- value: K.style.backgroundColor || "#ffffff",
9214
- onChange: (n) => U(K.id, { backgroundColor: n.target.value }),
9232
+ value: K.style.color || "#000000",
9233
+ onChange: (n) => U(K.id, { color: n.target.value }),
9215
9234
  style: {
9216
9235
  width: "100%",
9217
9236
  height: 32
9218
9237
  }
9219
- }), /* @__PURE__ */ jsx(o$1, {
9220
- variant: "outline",
9221
- onClick: () => U(K.id, { backgroundColor: void 0 }),
9222
- title: "Limpar fundo",
9223
- children: /* @__PURE__ */ jsx(Cross2Icon, {})
9224
- })]
9225
- })] })]
9226
- }),
9227
- /* @__PURE__ */ jsxs(p, {
9228
- gap: "3",
9229
- mt: "2",
9230
- children: [
9231
- /* @__PURE__ */ jsx(o, {
9232
- variant: K.style.fontWeight === "bold" ? "solid" : "outline",
9233
- onClick: () => U(K.id, { fontWeight: K.style.fontWeight === "bold" ? "normal" : "bold" }),
9234
- children: "Bold"
9235
- }),
9236
- /* @__PURE__ */ jsx(o, {
9237
- variant: K.style.fontStyle === "italic" ? "solid" : "outline",
9238
- onClick: () => U(K.id, { fontStyle: K.style.fontStyle === "italic" ? "normal" : "italic" }),
9239
- children: "Italic"
9240
- }),
9241
- /* @__PURE__ */ jsx(o, {
9242
- variant: K.style.textDecoration === "line-through" ? "solid" : "outline",
9243
- onClick: () => U(K.id, { textDecoration: K.style.textDecoration === "line-through" ? "none" : "line-through" }),
9244
- children: "Riscado"
9245
- })
9246
- ]
9247
- })
9238
+ })] }), /* @__PURE__ */ jsxs(p$1, { children: [/* @__PURE__ */ jsx(p$2, {
9239
+ size: "1",
9240
+ mb: "1",
9241
+ as: "div",
9242
+ children: "Cor de Fundo"
9243
+ }), /* @__PURE__ */ jsxs(p, {
9244
+ gap: "2",
9245
+ children: [/* @__PURE__ */ jsx("input", {
9246
+ type: "color",
9247
+ value: K.style.backgroundColor || "#ffffff",
9248
+ onChange: (n) => U(K.id, { backgroundColor: n.target.value }),
9249
+ style: {
9250
+ width: "100%",
9251
+ height: 32
9252
+ }
9253
+ }), /* @__PURE__ */ jsx(o$1, {
9254
+ variant: "outline",
9255
+ onClick: () => U(K.id, { backgroundColor: void 0 }),
9256
+ title: "Limpar fundo",
9257
+ children: /* @__PURE__ */ jsx(Cross2Icon, {})
9258
+ })]
9259
+ })] })]
9260
+ }),
9261
+ /* @__PURE__ */ jsxs(p, {
9262
+ gap: "3",
9263
+ mt: "2",
9264
+ children: [
9265
+ /* @__PURE__ */ jsx(o, {
9266
+ variant: K.style.fontWeight === "bold" ? "solid" : "outline",
9267
+ onClick: () => U(K.id, { fontWeight: K.style.fontWeight === "bold" ? "normal" : "bold" }),
9268
+ children: "Bold"
9269
+ }),
9270
+ /* @__PURE__ */ jsx(o, {
9271
+ variant: K.style.fontStyle === "italic" ? "solid" : "outline",
9272
+ onClick: () => U(K.id, { fontStyle: K.style.fontStyle === "italic" ? "normal" : "italic" }),
9273
+ children: "Italic"
9274
+ }),
9275
+ /* @__PURE__ */ jsx(o, {
9276
+ variant: K.style.textDecoration === "line-through" ? "solid" : "outline",
9277
+ onClick: () => U(K.id, { textDecoration: K.style.textDecoration === "line-through" ? "none" : "line-through" }),
9278
+ children: "Riscado"
9279
+ })
9280
+ ]
9281
+ })
9282
+ ] })
9248
9283
  ] })]
9249
9284
  }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
9250
9285
  /* @__PURE__ */ jsx(p$2, {
@@ -9933,9 +9968,14 @@ var formatValue = (n, s) => {
9933
9968
  });
9934
9969
  });
9935
9970
  }
9936
- let Jk = (s) => {
9971
+ let Jk = qk.display === "none";
9972
+ if (Jk && s) {
9973
+ let { display: n, ...s } = qk;
9974
+ qk = s;
9975
+ }
9976
+ let Yk = (s) => {
9937
9977
  s.stopPropagation(), d(n.id);
9938
- }, Yk = (s) => {
9978
+ }, Qk = (s) => {
9939
9979
  s.button === 0 && (s.stopPropagation(), d(n.id), F(!0), U.current = {
9940
9980
  x: s.clientX,
9941
9981
  y: s.clientY
@@ -9943,7 +9983,7 @@ var formatValue = (n, s) => {
9943
9983
  x: n.x,
9944
9984
  y: n.y
9945
9985
  });
9946
- }, Qk = (s) => {
9986
+ }, $k = (s) => {
9947
9987
  s.stopPropagation(), s.preventDefault(), V(!0);
9948
9988
  let d = s.target.closest(".resizable-element");
9949
9989
  if (d) {
@@ -9981,7 +10021,7 @@ var formatValue = (n, s) => {
9981
10021
  n.id,
9982
10022
  C
9983
10023
  ]);
9984
- let $k = {
10024
+ let eA = {
9985
10025
  position: "absolute",
9986
10026
  left: 0,
9987
10027
  top: 0,
@@ -10016,7 +10056,9 @@ var formatValue = (n, s) => {
10016
10056
  style: {
10017
10057
  position: "absolute",
10018
10058
  transform: `translate(${n.x}px, ${n.y}px) rotate(${n.rotation || 0}deg)`,
10019
- height: n.autoGrow ? "auto" : void 0
10059
+ height: n.autoGrow ? "auto" : void 0,
10060
+ display: Jk && !s ? "none" : void 0,
10061
+ opacity: Jk && s ? .4 : 1
10020
10062
  },
10021
10063
  enable: s && !n.autoGrow ? void 0 : {
10022
10064
  top: !1,
@@ -10037,9 +10079,9 @@ var formatValue = (n, s) => {
10037
10079
  position: "relative"
10038
10080
  },
10039
10081
  children: [/* @__PURE__ */ jsxs(p$1, {
10040
- style: $k,
10041
- onMouseDown: Yk,
10042
- onClick: Jk,
10082
+ style: eA,
10083
+ onMouseDown: Qk,
10084
+ onClick: Yk,
10043
10085
  onMouseEnter: (n) => {
10044
10086
  s || (n.currentTarget.style.borderColor = "var(--gray-6)");
10045
10087
  },
@@ -10097,7 +10139,7 @@ var formatValue = (n, s) => {
10097
10139
  zIndex: 50,
10098
10140
  boxShadow: "0 0 0 2px white"
10099
10141
  },
10100
- onMouseDown: Qk,
10142
+ onMouseDown: $k,
10101
10143
  children: /* @__PURE__ */ jsx(p$1, { style: {
10102
10144
  position: "absolute",
10103
10145
  top: 12,