@vipl520/dk-ui 1.0.48 → 1.0.49

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -2906,7 +2906,7 @@ const _hoisted_20$1 = { key: 3 };
2906
2906
  const _hoisted_21$1 = { class: "file-name over" };
2907
2907
  const _hoisted_22$1 = { class: "right" };
2908
2908
  const _hoisted_23$1 = { class: "block p-10px" };
2909
- const _hoisted_24$1 = {
2909
+ const _hoisted_24 = {
2910
2910
  key: 1,
2911
2911
  style: { "display": "flex", "align-items": "center", "justify-content": "center", "height": "340px" }
2912
2912
  };
@@ -3406,7 +3406,7 @@ var _sfc_main$13 = /* @__PURE__ */ defineComponent({
3406
3406
  ])
3407
3407
  ])), [
3408
3408
  [_directive_loading, loading.value]
3409
- ]) : (openBlock(), createElementBlock("div", _hoisted_24$1, [
3409
+ ]) : (openBlock(), createElementBlock("div", _hoisted_24, [
3410
3410
  createVNode(_component_el_empty, { description: "\u6682\u65E0\u6570\u636E" })
3411
3411
  ])),
3412
3412
  (openBlock(), createBlock(_component_dk_form, {
@@ -5353,8 +5353,8 @@ const styleBoxInputProps = {
5353
5353
  default: () => ({})
5354
5354
  },
5355
5355
  height: {
5356
- type: Number,
5357
- default: 180
5356
+ type: [Number, String],
5357
+ default: "auto"
5358
5358
  },
5359
5359
  help: {
5360
5360
  type: String,
@@ -5478,50 +5478,46 @@ const _hoisted_4$i = { class: "float-right cursor-pointer" };
5478
5478
  const _hoisted_5$d = { class: "name-header-operations" };
5479
5479
  const _hoisted_6$b = { class: "name-header-operations" };
5480
5480
  const _hoisted_7$b = { class: "name-header-operations" };
5481
- const _hoisted_8$9 = ["title"];
5482
- const _hoisted_9$7 = ["onMouseenter"];
5483
- const _hoisted_10$5 = ["onUpdate:modelValue", "onBlur"];
5484
- const _hoisted_11$5 = ["width", "height", "viewBox", "data-link-anchor", "innerHTML"];
5485
- const _hoisted_12$4 = /* @__PURE__ */ createElementVNode(
5481
+ const _hoisted_8$9 = ["title", "onClick"];
5482
+ const _hoisted_9$7 = ["onUpdate:modelValue", "onBlur"];
5483
+ const _hoisted_10$5 = ["width", "height", "viewBox", "data-link-anchor", "innerHTML"];
5484
+ const _hoisted_11$5 = /* @__PURE__ */ createElementVNode(
5486
5485
  "div",
5487
5486
  { style: { "position": "absolute", "display": "none", "width": "100%", "height": "100%" } },
5488
5487
  null,
5489
5488
  -1
5490
5489
  /* HOISTED */
5491
5490
  );
5492
- const _hoisted_13$3 = { class: "anchor-wrapper" };
5493
- const _hoisted_14$3 = ["onMousedown"];
5494
- const _hoisted_15$2 = /* @__PURE__ */ createElementVNode(
5491
+ const _hoisted_12$4 = { class: "anchor-wrapper" };
5492
+ const _hoisted_13$3 = ["onMousedown"];
5493
+ const _hoisted_14$3 = /* @__PURE__ */ createElementVNode(
5495
5494
  "span",
5496
5495
  { class: "title" },
5497
5496
  " \u5916\u8FB9\u8DDD ",
5498
5497
  -1
5499
5498
  /* HOISTED */
5500
5499
  );
5501
- const _hoisted_16$2 = { class: "thumnail border" };
5502
- const _hoisted_17$1 = ["title"];
5503
- const _hoisted_18 = ["onMouseenter"];
5504
- const _hoisted_19 = ["onUpdate:modelValue", "onBlur"];
5505
- const _hoisted_20 = ["width", "height", "viewBox", "data-link-anchor", "innerHTML"];
5506
- const _hoisted_21 = { class: "anchor-wrapper" };
5507
- const _hoisted_22 = ["onMousedown"];
5508
- const _hoisted_23 = /* @__PURE__ */ createElementVNode(
5500
+ const _hoisted_15$2 = { class: "thumnail border" };
5501
+ const _hoisted_16$2 = ["title", "onClick"];
5502
+ const _hoisted_17$1 = ["onUpdate:modelValue", "onBlur"];
5503
+ const _hoisted_18 = ["width", "height", "viewBox", "data-link-anchor", "innerHTML"];
5504
+ const _hoisted_19 = { class: "anchor-wrapper" };
5505
+ const _hoisted_20 = ["onMousedown"];
5506
+ const _hoisted_21 = /* @__PURE__ */ createElementVNode(
5509
5507
  "span",
5510
5508
  { class: "title" },
5511
5509
  " \u5185\u8FB9\u8DDD ",
5512
5510
  -1
5513
5511
  /* HOISTED */
5514
5512
  );
5515
- const _hoisted_24 = { class: "title" };
5516
- const _hoisted_25 = { class: "content-unit left-0" };
5517
- const _hoisted_26 = /* @__PURE__ */ createElementVNode(
5513
+ const _hoisted_22 = { class: "title" };
5514
+ const _hoisted_23 = /* @__PURE__ */ createElementVNode(
5518
5515
  "span",
5519
5516
  null,
5520
5517
  " x ",
5521
5518
  -1
5522
5519
  /* HOISTED */
5523
5520
  );
5524
- const _hoisted_27 = { class: "content-unit right-0" };
5525
5521
  const __default__$p = defineComponent({
5526
5522
  name: "DkStyleBoxInput"
5527
5523
  });
@@ -5551,13 +5547,17 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5551
5547
  width: props.modelValue.width || "",
5552
5548
  height: props.modelValue.height || ""
5553
5549
  });
5554
- ref(props.height);
5555
- watch(
5556
- () => props.height,
5557
- () => {
5558
- console.log("height", props.height);
5550
+ const box = ref(null);
5551
+ const { width } = useElementSize(box);
5552
+ const height = computed(() => {
5553
+ console.log("props.height", props.height);
5554
+ if (props.height === "auto") {
5555
+ const h = width.value / 1.8;
5556
+ return h > 300 ? 300 : h;
5557
+ } else {
5558
+ return props.height;
5559
5559
  }
5560
- );
5560
+ });
5561
5561
  watch(
5562
5562
  () => props.modelValue,
5563
5563
  (newVal, oldVal) => {
@@ -5650,17 +5650,16 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5650
5650
  stopChangeBound.value = handleMouseUp.bind(event);
5651
5651
  document.addEventListener("mouseup", stopChangeBound.value);
5652
5652
  dragging.value = true;
5653
- const height2 = props.height;
5654
5653
  const wrapperElement = document.querySelector(".wrapper");
5655
- const width = wrapperElement ? wrapperElement.offsetWidth : 0;
5654
+ const width2 = wrapperElement ? wrapperElement.offsetWidth : 0;
5656
5655
  const multiples = {
5657
5656
  margin: 0.9,
5658
5657
  padding: 0.9 * 0.7
5659
5658
  };
5660
5659
  const { clientX, clientY } = event;
5661
- const setCursorAndDimensions = (cursor, left, top, width2, height3) => {
5660
+ const setCursorAndDimensions = (cursor, left, top, width3, height2) => {
5662
5661
  document.body.style.cursor = cursor;
5663
- Object.assign(positionStyle, { left, top, width: width2, height: height3, display: "block" });
5662
+ Object.assign(positionStyle, { left, top, width: width3, height: height2, display: "block" });
5664
5663
  };
5665
5664
  startPosition.x = clientX;
5666
5665
  startPosition.y = clientY;
@@ -5668,16 +5667,16 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5668
5667
  setCursorAndDimensions(
5669
5668
  "ew-resize",
5670
5669
  clientX + "px",
5671
- clientY - height2 * 0.5 * multiples[type] + "px",
5670
+ clientY - height.value * 0.5 * multiples[type] + "px",
5672
5671
  "0.1px",
5673
- height2 * multiples[type] + "px"
5672
+ height.value * multiples[type] + "px"
5674
5673
  );
5675
5674
  } else {
5676
5675
  setCursorAndDimensions(
5677
5676
  "ns-resize",
5678
- clientX - width * 0.5 * multiples[type] + "px",
5677
+ clientX - width2 * 0.5 * multiples[type] + "px",
5679
5678
  clientY + "px",
5680
- width * multiples[type] + "px",
5679
+ width2 * multiples[type] + "px",
5681
5680
  "0.1px"
5682
5681
  );
5683
5682
  }
@@ -5856,9 +5855,11 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5856
5855
  createElementVNode(
5857
5856
  "div",
5858
5857
  {
5858
+ ref_key: "box",
5859
+ ref: box,
5859
5860
  tabindex: "0",
5860
5861
  class: "wrapper",
5861
- style: normalizeStyle([{ "margin-top": "10px" }, { height: props.height + "px" }])
5862
+ style: normalizeStyle([{ "margin-top": "10px" }, { height: height.value + "px" }])
5862
5863
  },
5863
5864
  [
5864
5865
  createElementVNode(
@@ -5878,11 +5879,16 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5878
5879
  return openBlock(), createElementBlock("div", { key }, [
5879
5880
  createElementVNode("span", {
5880
5881
  title: item.title,
5881
- class: normalizeClass(`anchor-tip-${item.position} value-indicator`)
5882
+ class: normalizeClass(`anchor-tip-${item.position} value-indicator`),
5883
+ onClick: ($event) => onDblclick(item.value, key)
5882
5884
  }, [
5883
- createElementVNode("span", {
5884
- onMouseenter: ($event) => onDblclick(item.value, key)
5885
- }, toDisplayString(getValue(styles[item.value])), 41, _hoisted_9$7)
5885
+ createElementVNode(
5886
+ "span",
5887
+ null,
5888
+ toDisplayString(getValue(styles[item.value])),
5889
+ 1
5890
+ /* TEXT */
5891
+ )
5886
5892
  ], 10, _hoisted_8$9),
5887
5893
  withDirectives(createElementVNode("input", {
5888
5894
  ref_for: true,
@@ -5891,7 +5897,7 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5891
5897
  "onUpdate:modelValue": ($event) => styles[item.value] = $event,
5892
5898
  class: normalizeClass("input-box anchor-tip-" + item.position + (showStyles[item.value] ? " show" : "")),
5893
5899
  onBlur: ($event) => onBlur(item.value)
5894
- }, null, 42, _hoisted_10$5), [
5900
+ }, null, 42, _hoisted_9$7), [
5895
5901
  [vModelText, styles[item.value]]
5896
5902
  ]),
5897
5903
  (openBlock(), createElementBlock("svg", {
@@ -5903,15 +5909,15 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5903
5909
  style: normalizeStyle(item.svg.style),
5904
5910
  class: "esm-modal-svg",
5905
5911
  innerHTML: item.svg.content
5906
- }, null, 12, _hoisted_11$5))
5912
+ }, null, 12, _hoisted_10$5))
5907
5913
  ]);
5908
5914
  }),
5909
5915
  128
5910
5916
  /* KEYED_FRAGMENT */
5911
5917
  ))
5912
5918
  ]),
5913
- _hoisted_12$4,
5914
- createElementVNode("div", _hoisted_13$3, [
5919
+ _hoisted_11$5,
5920
+ createElementVNode("div", _hoisted_12$4, [
5915
5921
  (openBlock(), createElementBlock(
5916
5922
  Fragment,
5917
5923
  null,
@@ -5922,16 +5928,16 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5922
5928
  onMousemove: handleMouseMove,
5923
5929
  onMousedown: ($event) => handleMouseDown("margin", item, $event),
5924
5930
  onMouseup: handleMouseUp
5925
- }, null, 42, _hoisted_14$3);
5931
+ }, null, 42, _hoisted_13$3);
5926
5932
  }),
5927
5933
  64
5928
5934
  /* STABLE_FRAGMENT */
5929
5935
  ))
5930
5936
  ]),
5931
- _hoisted_15$2,
5937
+ _hoisted_14$3,
5932
5938
  createCommentVNode("\u5916\u8FB9\u8DDD Margin END"),
5933
5939
  createCommentVNode("\u5185\u8FB9\u8DDD Padding"),
5934
- createElementVNode("div", _hoisted_16$2, [
5940
+ createElementVNode("div", _hoisted_15$2, [
5935
5941
  createElementVNode(
5936
5942
  "div",
5937
5943
  {
@@ -5948,12 +5954,17 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5948
5954
  return openBlock(), createElementBlock("div", { key }, [
5949
5955
  createElementVNode("span", {
5950
5956
  title: item.title,
5951
- class: normalizeClass(`anchor-tip-${item.position} value-indicator`)
5957
+ class: normalizeClass(`anchor-tip-${item.position} value-indicator`),
5958
+ onClick: ($event) => onDblclick(item.value, key + 4)
5952
5959
  }, [
5953
- createElementVNode("span", {
5954
- onMouseenter: ($event) => onDblclick(item.value, key + 4)
5955
- }, toDisplayString(getValue(styles[item.value])), 41, _hoisted_18)
5956
- ], 10, _hoisted_17$1),
5960
+ createElementVNode(
5961
+ "span",
5962
+ null,
5963
+ toDisplayString(getValue(styles[item.value])),
5964
+ 1
5965
+ /* TEXT */
5966
+ )
5967
+ ], 10, _hoisted_16$2),
5957
5968
  withDirectives(createElementVNode("input", {
5958
5969
  ref_for: true,
5959
5970
  ref_key: "inputField",
@@ -5961,7 +5972,7 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5961
5972
  "onUpdate:modelValue": ($event) => styles[item.value] = $event,
5962
5973
  class: normalizeClass("input-box anchor-tip-" + item.position + (showStyles[item.value] ? " show" : "")),
5963
5974
  onBlur: ($event) => onBlur(item.value)
5964
- }, null, 42, _hoisted_19), [
5975
+ }, null, 42, _hoisted_17$1), [
5965
5976
  [vModelText, styles[item.value]]
5966
5977
  ]),
5967
5978
  (openBlock(), createElementBlock("svg", {
@@ -5973,14 +5984,14 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5973
5984
  style: normalizeStyle(item.svg.style),
5974
5985
  class: "esm-modal-svg",
5975
5986
  innerHTML: item.svg.content
5976
- }, null, 12, _hoisted_20))
5987
+ }, null, 12, _hoisted_18))
5977
5988
  ]);
5978
5989
  }),
5979
5990
  128
5980
5991
  /* KEYED_FRAGMENT */
5981
5992
  ))
5982
5993
  ]),
5983
- createElementVNode("div", _hoisted_21, [
5994
+ createElementVNode("div", _hoisted_19, [
5984
5995
  (openBlock(), createElementBlock(
5985
5996
  Fragment,
5986
5997
  null,
@@ -5991,13 +6002,13 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
5991
6002
  onMousemove: handleMouseMove,
5992
6003
  onMousedown: ($event) => handleMouseDown("padding", item, $event),
5993
6004
  onMouseup: handleMouseUp
5994
- }, null, 42, _hoisted_22);
6005
+ }, null, 42, _hoisted_20);
5995
6006
  }),
5996
6007
  64
5997
6008
  /* STABLE_FRAGMENT */
5998
6009
  ))
5999
6010
  ]),
6000
- _hoisted_23,
6011
+ _hoisted_21,
6001
6012
  createCommentVNode("\u5185\u8FB9\u8DDD END"),
6002
6013
  createElementVNode(
6003
6014
  "div",
@@ -6007,16 +6018,17 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
6007
6018
  onMouseleave: _cache[10] || (_cache[10] = ($event) => onMouseMove("widthHeight", "leave", $event))
6008
6019
  },
6009
6020
  [
6010
- createElementVNode("span", _hoisted_24, [
6011
- createElementVNode("span", _hoisted_25, [
6021
+ createElementVNode("span", _hoisted_22, [
6022
+ createElementVNode("span", {
6023
+ class: "content-unit left-0",
6024
+ onClick: _cache[3] || (_cache[3] = ($event) => onDblclick("width", 9))
6025
+ }, [
6012
6026
  createElementVNode(
6013
6027
  "em",
6014
- {
6015
- onMouseenter: _cache[3] || (_cache[3] = ($event) => onDblclick("width", 9))
6016
- },
6028
+ null,
6017
6029
  toDisplayString(getValue(styles["width"])),
6018
- 33
6019
- /* TEXT, HYDRATE_EVENTS */
6030
+ 1
6031
+ /* TEXT */
6020
6032
  )
6021
6033
  ]),
6022
6034
  withDirectives(createElementVNode(
@@ -6034,16 +6046,17 @@ var _sfc_main$Q = /* @__PURE__ */ defineComponent({
6034
6046
  ), [
6035
6047
  [vModelText, styles.width]
6036
6048
  ]),
6037
- _hoisted_26,
6038
- createElementVNode("span", _hoisted_27, [
6049
+ _hoisted_23,
6050
+ createElementVNode("span", {
6051
+ class: "content-unit right-0",
6052
+ onClick: _cache[6] || (_cache[6] = ($event) => onDblclick("height", 9))
6053
+ }, [
6039
6054
  createElementVNode(
6040
6055
  "em",
6041
- {
6042
- onMouseenter: _cache[6] || (_cache[6] = ($event) => onDblclick("height", 9))
6043
- },
6056
+ null,
6044
6057
  toDisplayString(getValue(styles["height"])),
6045
- 33
6046
- /* TEXT, HYDRATE_EVENTS */
6058
+ 1
6059
+ /* TEXT */
6047
6060
  )
6048
6061
  ]),
6049
6062
  withDirectives(createElementVNode(
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "dk",
5
- "version": "1.0.47",
5
+ "version": "1.0.49",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -4,8 +4,8 @@ export declare const StyleBoxInput: import("@vipl520/utils").WithInstall<import(
4
4
  default: () => {};
5
5
  };
6
6
  height: {
7
- type: NumberConstructor;
8
- default: number;
7
+ type: (StringConstructor | NumberConstructor)[];
8
+ default: string;
9
9
  };
10
10
  help: {
11
11
  type: StringConstructor;
@@ -17,8 +17,8 @@ export declare const StyleBoxInput: import("@vipl520/utils").WithInstall<import(
17
17
  default: () => {};
18
18
  };
19
19
  height: {
20
- type: NumberConstructor;
21
- default: number;
20
+ type: (StringConstructor | NumberConstructor)[];
21
+ default: string;
22
22
  };
23
23
  help: {
24
24
  type: StringConstructor;
@@ -29,7 +29,7 @@ export declare const StyleBoxInput: import("@vipl520/utils").WithInstall<import(
29
29
  onChange?: ((...args: any[]) => any) | undefined;
30
30
  }, {
31
31
  modelValue: Record<string, any>;
32
- height: number;
32
+ height: string | number;
33
33
  help: string;
34
34
  }, {}>>;
35
35
  export default StyleBoxInput;
@@ -5,8 +5,8 @@ export declare const styleBoxInputProps: {
5
5
  default: () => {};
6
6
  };
7
7
  height: {
8
- type: NumberConstructor;
9
- default: number;
8
+ type: (StringConstructor | NumberConstructor)[];
9
+ default: string;
10
10
  };
11
11
  help: {
12
12
  type: StringConstructor;
@@ -4,8 +4,8 @@ const styleBoxInputProps = {
4
4
  default: () => ({})
5
5
  },
6
6
  height: {
7
- type: Number,
8
- default: 180
7
+ type: [Number, String],
8
+ default: "auto"
9
9
  },
10
10
  help: {
11
11
  type: String,
@@ -1 +1 @@
1
- {"version":3,"file":"props.mjs","sources":["../../../src/style-box-input/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n\nexport const styleBoxInputProps = {\n modelValue: {\n type: Object,\n default: () => ({}),\n },\n height: {\n type: Number,\n default: 180,\n },\n help: {\n type: String,\n default:\n '可以双击对应位置来配置内外边距和宽度高度,也支持通过描点拖拽增加,支持单位(px、rem、%、auto)',\n },\n}\n\nexport type StyleBoxInputProps = ExtractPropTypes<typeof styleBoxInputProps>\n"],"names":[],"mappings":"AAEO,MAAM,kBAAqB,GAAA;AAAA,EAChC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,OAAA,EAAS,OAAO,EAAC,CAAA;AAAA,GACnB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,GAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OACE,EAAA,mQAAA;AAAA,GACJ;AACF;;;;"}
1
+ {"version":3,"file":"props.mjs","sources":["../../../src/style-box-input/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n\nexport const styleBoxInputProps = {\n modelValue: {\n type: Object,\n default: () => ({}),\n },\n height: {\n type: [Number, String],\n default: 'auto',\n },\n help: {\n type: String,\n default: '可以双击对应位置来配置内外边距和宽度高度,也支持通过描点拖拽增加,支持单位(px、rem、%、auto)',\n },\n}\n\nexport type StyleBoxInputProps = ExtractPropTypes<typeof styleBoxInputProps>\n"],"names":[],"mappings":"AAEO,MAAM,kBAAqB,GAAA;AAAA,EAChC,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,IACN,OAAA,EAAS,OAAO,EAAC,CAAA;AAAA,GACnB;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,IACrB,OAAS,EAAA,MAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,mQAAA;AAAA,GACX;AACF;;;;"}
@@ -4,8 +4,8 @@ declare const _default: import("vue").DefineComponent<{
4
4
  default: () => {};
5
5
  };
6
6
  height: {
7
- type: NumberConstructor;
8
- default: number;
7
+ type: (StringConstructor | NumberConstructor)[];
8
+ default: string;
9
9
  };
10
10
  help: {
11
11
  type: StringConstructor;
@@ -17,8 +17,8 @@ declare const _default: import("vue").DefineComponent<{
17
17
  default: () => {};
18
18
  };
19
19
  height: {
20
- type: NumberConstructor;
21
- default: number;
20
+ type: (StringConstructor | NumberConstructor)[];
21
+ default: string;
22
22
  };
23
23
  help: {
24
24
  type: StringConstructor;
@@ -29,7 +29,7 @@ declare const _default: import("vue").DefineComponent<{
29
29
  onChange?: ((...args: any[]) => any) | undefined;
30
30
  }, {
31
31
  modelValue: Record<string, any>;
32
- height: number;
32
+ height: string | number;
33
33
  help: string;
34
34
  }, {}>;
35
35
  export default _default;