@opentiny/vue-renderless 3.17.6 → 3.18.0-beta.1

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.
Files changed (152) hide show
  1. package/README.md +12 -3
  2. package/action-menu/index.js +2 -2
  3. package/action-menu/vue.js +2 -2
  4. package/anchor/index.js +11 -4
  5. package/autocomplete/index.js +20 -14
  6. package/autocomplete/vue.js +36 -9
  7. package/badge/index.js +4 -3
  8. package/base-select/index.js +3 -3
  9. package/breadcrumb-item/vue.js +1 -1
  10. package/button-group/index.js +6 -1
  11. package/carousel-item/index.js +1 -1
  12. package/checkbox/index.js +1 -1
  13. package/collapse-item/index.js +7 -1
  14. package/collapse-item/vue.js +12 -2
  15. package/color-picker/index.js +20 -32
  16. package/color-picker/vue.js +31 -54
  17. package/color-select-panel/index.js +8 -5
  18. package/color-select-panel/vue.js +1 -2
  19. package/common/deps/clickoutside.js +10 -3
  20. package/common/deps/dom.js +9 -1
  21. package/common/deps/tree-model/tree-store.js +13 -2
  22. package/common/deps/useRelation.js +24 -7
  23. package/common/deps/useWindowSize.js +23 -0
  24. package/common/form/const.js +10 -0
  25. package/common/index.js +1 -1
  26. package/common/prop-util.js +43 -0
  27. package/common/runtime.js +1 -1
  28. package/common/xss.js +2 -2
  29. package/crop/index.js +14 -22
  30. package/crop/vue.js +33 -29
  31. package/date-panel/index.js +13 -2
  32. package/date-panel/vue.js +16 -10
  33. package/dialog-box/index.js +1 -1
  34. package/dialog-select/index.js +40 -13
  35. package/dialog-select/vue.js +3 -3
  36. package/drawer/index.js +13 -0
  37. package/drawer/vue.js +4 -3
  38. package/dropdown-item/index.js +2 -2
  39. package/dropdown-item/mf.js +1 -1
  40. package/dropdown-item/vue.js +9 -6
  41. package/dropdown-menu/index.js +3 -0
  42. package/dropdown-menu/vue.js +5 -3
  43. package/fall-menu/index.js +4 -0
  44. package/fall-menu/vue.js +15 -2
  45. package/file-upload/index.js +4 -4
  46. package/filter-box/vue.js +5 -2
  47. package/fluent-editor/index.js +10 -3
  48. package/fluent-editor/options.js +93 -27
  49. package/fluent-editor/vue.js +8 -8
  50. package/form/index.js +7 -4
  51. package/form/vue.js +1 -1
  52. package/form-item/index.js +6 -1
  53. package/form-item/vue.js +3 -1
  54. package/grid/utils/dom.js +3 -1
  55. package/guide/index.js +21 -6
  56. package/input/index.js +17 -1
  57. package/input/vue.js +19 -8
  58. package/ip-address/index.js +0 -10
  59. package/ip-address/vue.js +2 -5
  60. package/load-list/index.js +43 -0
  61. package/load-list/vue.js +69 -0
  62. package/milestone/index.js +55 -8
  63. package/milestone/vue.js +16 -3
  64. package/modal/index.js +6 -6
  65. package/modal/vue.js +4 -3
  66. package/nav-menu/index.js +7 -3
  67. package/option/index.js +0 -15
  68. package/option/vue.js +2 -13
  69. package/package.json +7 -7
  70. package/pager/index.js +25 -0
  71. package/pager/vue.js +18 -4
  72. package/pager-item/index.js +4 -7
  73. package/picker/index.js +27 -7
  74. package/picker/vue.js +2 -1
  75. package/pop-upload/index.js +13 -4
  76. package/pop-upload/vue.js +4 -0
  77. package/popeditor/index.js +14 -2
  78. package/popeditor/vue.js +9 -5
  79. package/rich-text-editor/vue.js +9 -3
  80. package/select/index.js +12 -11
  81. package/select/vue.js +14 -5
  82. package/slider/index.js +2 -2
  83. package/slider-button/index.js +8 -3
  84. package/slider-button/vue.js +6 -2
  85. package/slider-button-group/index.js +46 -9
  86. package/slider-button-group/vue.js +40 -18
  87. package/split/vue.js +4 -2
  88. package/sticky/index.js +89 -0
  89. package/sticky/vue.js +74 -0
  90. package/tab-item-mf/vue.js +6 -1
  91. package/tabs-mf/index.js +58 -3
  92. package/tabs-mf/vue-bar.js +0 -6
  93. package/tabs-mf/vue-swipe.js +20 -0
  94. package/tabs-mf/vue.js +22 -4
  95. package/time/index.js +6 -1
  96. package/time/vue.js +8 -2
  97. package/time-line/index.js +1 -1
  98. package/time-line-new/index.js +53 -0
  99. package/time-line-new/vue.js +41 -0
  100. package/time-range/vue.js +4 -1
  101. package/time-spinner/index.js +4 -1
  102. package/time-spinner/vue.js +2 -2
  103. package/tooltip/vue.js +16 -3
  104. package/transfer-panel/vue.js +7 -6
  105. package/tree/index.js +18 -7
  106. package/tree/vue.js +14 -7
  107. package/tree-node/index.js +2 -2
  108. package/tree-node/vue.js +6 -2
  109. package/tree-select/index.js +6 -6
  110. package/tree-select/vue.js +1 -1
  111. package/types/action-menu.type.d.ts +1 -1
  112. package/types/alert.type.d.ts +2 -0
  113. package/types/autocomplete.type.d.ts +17 -13
  114. package/types/badge.type.d.ts +1 -1
  115. package/types/button-group.type.d.ts +3 -0
  116. package/types/button.type.d.ts +21 -0
  117. package/types/checkbox.type.d.ts +1 -0
  118. package/types/date-picker.type.d.ts +3 -0
  119. package/types/drawer.type.d.ts +5 -1
  120. package/types/{dropdown-item.type-678794c9.d.ts → dropdown-item.type-c9badbc1.d.ts} +6 -2
  121. package/types/dropdown-item.type.d.ts +1 -1
  122. package/types/dropdown-menu.type.d.ts +1 -1
  123. package/types/dropdown.type.d.ts +4 -0
  124. package/types/fall-menu.type.d.ts +1 -0
  125. package/types/file-upload.type.d.ts +1 -1
  126. package/types/form-item.type.d.ts +1 -1
  127. package/types/{form.type-33aa784a.d.ts → form.type-f6fb4c38.d.ts} +5 -0
  128. package/types/form.type.d.ts +1 -1
  129. package/types/input.type.d.ts +12 -2
  130. package/types/link.type.d.ts +6 -1
  131. package/types/load-list.type.d.ts +58 -0
  132. package/types/milestone.type.d.ts +27 -1
  133. package/types/modal.type.d.ts +3 -2
  134. package/types/pager.type.d.ts +5 -1
  135. package/types/picker.type.d.ts +3 -0
  136. package/types/popover.type.d.ts +1 -1
  137. package/types/search.type.d.ts +4 -0
  138. package/types/steps.type.d.ts +1 -0
  139. package/types/tag.type.d.ts +1 -0
  140. package/types/tooltip.type.d.ts +3 -0
  141. package/types/transfer.type.d.ts +3 -3
  142. package/types/tree-menu.type.d.ts +4 -1
  143. package/types/upload-dragger.type.d.ts +1 -1
  144. package/types/{upload-list.type-02a1effb.d.ts → upload-list.type-26173587.d.ts} +17 -3
  145. package/types/upload-list.type.d.ts +1 -1
  146. package/types/upload.type.d.ts +1 -1
  147. package/upload-list/vue.js +7 -7
  148. package/virtual-scroll-box/index.js +294 -0
  149. package/virtual-scroll-box/vue.js +43 -0
  150. package/virtual-tree/index.js +168 -0
  151. package/virtual-tree/vue.js +53 -0
  152. package/LICENSE +0 -22
@@ -11,7 +11,10 @@ if (!isServer) {
11
11
  nodeList.filter((node) => node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
12
12
  });
13
13
  on(document, "mouseup", (event) => {
14
- nodeList.filter((node) => !node[nameSpace].mousedownTrigger).forEach((node) => node[nameSpace].documentHandler(event, startClick));
14
+ nodeList.filter((node) => !node[nameSpace].mousedownTrigger).forEach((node) => {
15
+ var _a;
16
+ return node[nameSpace].documentHandler(event, ((_a = node[nameSpace]) == null ? void 0 : _a.mouseupTrigger) ? event : startClick);
17
+ });
15
18
  startClick = null;
16
19
  });
17
20
  }
@@ -31,20 +34,24 @@ var clickoutside_default = {
31
34
  nodeList.push(el);
32
35
  const id = seed++;
33
36
  const { modifiers, expression, value } = binding;
37
+ const { mousedown = false, mouseup = false } = modifiers || {};
34
38
  el[nameSpace] = {
35
39
  id,
36
40
  documentHandler: createDocumentHandler(el, binding, vnode),
37
41
  methodName: expression,
38
42
  bindingFn: value,
39
- mousedownTrigger: modifiers.mousedown
43
+ mousedownTrigger: mousedown,
44
+ mouseupTrigger: mouseup
40
45
  };
41
46
  },
42
47
  update: (el, binding, vnode) => {
43
48
  const { modifiers, expression, value } = binding;
49
+ const { mousedown = false, mouseup = false } = modifiers || {};
44
50
  el[nameSpace].documentHandler = createDocumentHandler(el, binding, vnode);
45
51
  el[nameSpace].methodName = expression;
46
52
  el[nameSpace].bindingFn = value;
47
- el[nameSpace].mousedownTrigger = modifiers.mousedown;
53
+ el[nameSpace].mousedownTrigger = mousedown;
54
+ el[nameSpace].mouseupTrigger = mouseup;
48
55
  },
49
56
  unbind: (el) => {
50
57
  if (el.nodeType !== Node.ELEMENT_NODE) {
@@ -170,6 +170,13 @@ const getScrollParent = (el, root = defaultRoot) => {
170
170
  }
171
171
  return root;
172
172
  };
173
+ const useScrollParent = ({ onMounted, ref, watch }) => (elRef, root = defaultRoot) => {
174
+ const scrollParent = ref();
175
+ const setScrollParent = () => scrollParent.value = getScrollParent(elRef.value, root);
176
+ watch(elRef, setScrollParent);
177
+ onMounted(() => elRef.value && setScrollParent());
178
+ return scrollParent;
179
+ };
173
180
  const isDisplayNone = (elm) => {
174
181
  if (isServer)
175
182
  return false;
@@ -205,5 +212,6 @@ export {
205
212
  preventDefault,
206
213
  removeClass,
207
214
  setStyle,
208
- stopPropagation
215
+ stopPropagation,
216
+ useScrollParent
209
217
  };
@@ -26,12 +26,23 @@ class TreeStore {
26
26
  this._initDefaultCheckedNodes();
27
27
  }
28
28
  }
29
+ getMappingData(data) {
30
+ const props = this.props || {};
31
+ const mapping = {};
32
+ for (let key in props) {
33
+ if (hasOwn.call(props, key)) {
34
+ mapping[key] = data[props[key]];
35
+ }
36
+ }
37
+ return __spreadValues(__spreadValues({}, data), mapping);
38
+ }
29
39
  filter(value) {
30
- const { lazy, filterNodeMethod } = this;
40
+ const { lazy, filterNodeMethod, getMappingData } = this;
31
41
  const walkTree = (node) => {
32
42
  const childNodes = node.root ? node.root.childNodes : node.childNodes;
33
43
  childNodes.forEach((child) => {
34
- child.visible = filterNodeMethod.call(child, value, child.data, child);
44
+ const mappingData = getMappingData.call(this, child.data);
45
+ child.visible = filterNodeMethod.call(child, value, mappingData, child);
35
46
  walkTree(child);
36
47
  });
37
48
  if (!node.visible && childNodes.length) {
@@ -1,19 +1,32 @@
1
1
  import "../../chunk-G2ADBYYC.js";
2
2
  import { noop } from "../function";
3
3
  import { onMountedOrActivated as createHook } from "./useEventListener";
4
- const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted, onActivated, onUnmounted, provide, reactive, toRef }) => ({ relationKey, relationContainer, onChange, childrenKey } = {}) => {
4
+ const useRelation = ({
5
+ computed,
6
+ getCurrentInstance,
7
+ inject,
8
+ markRaw,
9
+ nextTick,
10
+ onMounted,
11
+ onActivated,
12
+ onUnmounted,
13
+ provide,
14
+ reactive,
15
+ toRef
16
+ }) => ({ relationKey, relationContainer, onChange, childrenKey, delivery } = {}) => {
5
17
  if (!relationKey) {
6
18
  throw new Error("[TINY Error]<relationKey> must exist.");
7
19
  }
8
20
  const instance = getCurrentInstance();
9
- const state = reactive({ children: [] });
21
+ const state = reactive({ children: [], indexInParent: -1 });
10
22
  const injectValue = inject(relationKey, null);
11
23
  let callbacks = [];
12
24
  if (injectValue) {
13
- const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey } = injectValue;
25
+ const { link: link2, unlink: unlink2, callbacks: injectCbs, childrenKey: injectKey, delivery: injectDelivery } = injectValue;
14
26
  callbacks = injectCbs;
15
27
  childrenKey = childrenKey || injectKey || "instanceChildren";
16
- link2(instance);
28
+ delivery = injectDelivery;
29
+ state.indexInParent = link2(instance);
17
30
  onUnmounted(() => unlink2(instance));
18
31
  } else {
19
32
  childrenKey = childrenKey || "instanceChildren";
@@ -41,7 +54,11 @@ const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted,
41
54
  callbacks = null;
42
55
  });
43
56
  }
44
- const link = (child) => state.children.push(markRaw(child.proxy));
57
+ const link = (child) => {
58
+ const childPublic = child.proxy;
59
+ state.children.push(markRaw(childPublic));
60
+ return computed(() => state.children.indexOf(childPublic));
61
+ };
45
62
  const unlink = (child) => {
46
63
  const index = state.children.indexOf(child.proxy);
47
64
  if (index > -1) {
@@ -49,10 +66,10 @@ const useRelation = ({ getCurrentInstance, inject, markRaw, nextTick, onMounted,
49
66
  }
50
67
  };
51
68
  callbacks.push((flattenNodes) => sortPublicInstances(state.children, flattenNodes));
52
- provide(relationKey, { link, unlink, callbacks, childrenKey });
69
+ provide(relationKey, { link, unlink, callbacks, childrenKey, delivery });
53
70
  Object.defineProperty(instance.proxy, childrenKey, { configurable: true, get: () => state.children });
54
71
  onUnmounted(() => delete instance.proxy[childrenKey]);
55
- return { children: toRef(state, "children") };
72
+ return { children: toRef(state, "children"), index: toRef(state, "indexInParent"), delivery };
56
73
  };
57
74
  const flattenChildNodes = (childNodes, result) => {
58
75
  if (childNodes.length) {
@@ -0,0 +1,23 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ import { on, isServer } from "./dom";
3
+ let width;
4
+ let height;
5
+ const useWindowSize = (ref) => () => {
6
+ if (!width) {
7
+ width = ref(0);
8
+ height = ref(0);
9
+ if (!isServer) {
10
+ const update = () => {
11
+ width.value = window.innerWidth;
12
+ height.value = window.innerHeight;
13
+ };
14
+ update();
15
+ on(window, "resize", update, { passive: true });
16
+ on(window, "orientationchange", update, { passive: true });
17
+ }
18
+ }
19
+ return { width, height };
20
+ };
21
+ export {
22
+ useWindowSize
23
+ };
@@ -0,0 +1,10 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ const FORM_ITEM = "FormItem";
3
+ const FORM_EVENT = {
4
+ change: "form.change",
5
+ blur: "form.blur"
6
+ };
7
+ export {
8
+ FORM_EVENT,
9
+ FORM_ITEM
10
+ };
package/common/index.js CHANGED
@@ -237,7 +237,7 @@ const CASCADER = {
237
237
  PropsHover: "hoverThreshold",
238
238
  MenuConnector: "cascader-menu-"
239
239
  };
240
- const version = "3.17.6";
240
+ const version = "3.18.6";
241
241
  const log = (data, type = "log") => {
242
242
  uLog.logger[type](data);
243
243
  };
@@ -0,0 +1,43 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const unknownProp = null;
3
+ const numericProp = [Number, String];
4
+ const truthProp = {
5
+ type: Boolean,
6
+ default: true
7
+ };
8
+ const makeRequiredProp = (type) => ({
9
+ type,
10
+ required: true
11
+ });
12
+ const makeArrayProp = () => ({
13
+ type: Array,
14
+ default: () => []
15
+ });
16
+ const makeNumberProp = (defaultVal) => ({
17
+ type: Number,
18
+ default: defaultVal
19
+ });
20
+ const makeNumericProp = (defaultVal) => ({
21
+ type: numericProp,
22
+ default: defaultVal
23
+ });
24
+ const makeStringProp = (defaultVal) => ({
25
+ type: String,
26
+ default: defaultVal
27
+ });
28
+ const makeStringValidProp = (defaultVal, optionals = []) => ({
29
+ type: String,
30
+ default: defaultVal,
31
+ validator: (val) => optionals.includes(val)
32
+ });
33
+ export {
34
+ makeArrayProp,
35
+ makeNumberProp,
36
+ makeNumericProp,
37
+ makeRequiredProp,
38
+ makeStringProp,
39
+ makeStringValidProp,
40
+ numericProp,
41
+ truthProp,
42
+ unknownProp
43
+ };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.17.6";
25
+ const version = "3.18.6";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/common/xss.js CHANGED
@@ -9,7 +9,7 @@ let xssOptions = {
9
9
  enableUrl: true,
10
10
  html: {
11
11
  whiteList: {
12
- a: ["class", "style", "contenteditable", "data-id", "data-title", "data-size", "data-last-modified"],
12
+ a: ["class", "style", "contenteditable", "data-id", "data-title", "data-size", "data-last-modified", "href"],
13
13
  address: ["class", "style"],
14
14
  area: ["class", "style"],
15
15
  article: ["class", "style"],
@@ -61,7 +61,7 @@ let xssOptions = {
61
61
  header: ["class", "style"],
62
62
  hr: ["class", "style"],
63
63
  i: ["class", "style", "data-image-id", "data-image"],
64
- img: ["class", "style", "devui-editorx-image", "style", "data-image-id"],
64
+ img: ["class", "style", "devui-editorx-image", "style", "data-image-id", "src"],
65
65
  input: ["class", "style", "data-formula", "data-link", "data-video"],
66
66
  ins: ["class", "style"],
67
67
  li: ["class", "style"],
package/crop/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { on, off } from "../common/deps/dom";
3
3
  import { toFileSize } from "../common/string";
4
- const computedCropImages = ({ constants, t }) => () => t(constants.CROP_IMAGE);
5
4
  const watchImageSrc = (state) => (value) => state.src = value;
6
- const watchAlt = (state) => (value) => state.alt = value || "image";
7
5
  const watchVisible = ({ api, state }) => (value) => {
8
6
  if (value) {
9
7
  on(document.body, "keydown", api.shortcutKeys);
@@ -13,35 +11,38 @@ const watchVisible = ({ api, state }) => (value) => {
13
11
  state.cropvisible = value;
14
12
  };
15
13
  const shortcutKeys = (api) => (e) => {
16
- if (e.keyCode == 187 && e.ctrlKey) {
14
+ if (e.keyCode === 187 && e.ctrlKey) {
17
15
  e.preventDefault();
18
16
  api.zoom(0.1);
19
17
  }
20
- if (e.keyCode == 189 && e.ctrlKey) {
18
+ if (e.keyCode === 189 && e.ctrlKey) {
21
19
  e.preventDefault();
22
20
  api.zoom(-0.1);
23
21
  }
24
- if (e.keyCode == 38 && e.ctrlKey) {
22
+ if (e.keyCode === 38 && e.ctrlKey) {
25
23
  e.preventDefault();
26
24
  api.move(0, 1);
27
25
  }
28
- if (e.keyCode == 40 && e.ctrlKey) {
26
+ if (e.keyCode === 40 && e.ctrlKey) {
29
27
  e.preventDefault();
30
28
  api.move(0, -1);
31
29
  }
32
- if (e.keyCode == 37 && e.ctrlKey) {
30
+ if (e.keyCode === 37 && e.ctrlKey) {
33
31
  e.preventDefault();
34
32
  api.move(1, 0);
35
33
  }
36
- if (e.keyCode == 39 && e.ctrlKey) {
34
+ if (e.keyCode === 39 && e.ctrlKey) {
37
35
  e.preventDefault();
38
36
  api.move(-1, 0);
39
37
  }
38
+ if (e.keyCode === 27) {
39
+ e.preventDefault();
40
+ api.closeCrop();
41
+ }
40
42
  };
41
43
  const closeCrop = ({ emit, state }) => () => {
42
44
  emit("update:cropvisible", false);
43
45
  emit("update:visible", false);
44
- state.cropImg = "";
45
46
  };
46
47
  const createCrop = ({ emit, props, refs, state }) => () => {
47
48
  const Cropper = props.plugin;
@@ -67,7 +68,6 @@ const createCrop = ({ emit, props, refs, state }) => () => {
67
68
  minCropBoxHeight: props.minCropBoxHeight,
68
69
  minContainerWidth: props.minContainerWidth,
69
70
  minContainerHeight: props.minContainerHeight,
70
- preview: document.querySelectorAll(".croppreview"),
71
71
  ready() {
72
72
  emit("ready");
73
73
  },
@@ -88,19 +88,13 @@ const createCrop = ({ emit, props, refs, state }) => () => {
88
88
  const closeCropArea = (api) => () => api.clear();
89
89
  const clear = (state) => () => state.cropper.clear();
90
90
  const cropImage = ({ api, emit, props, state }) => () => {
91
- state.cropImg = api.getCroppedCanvas().toDataURL("image/jpeg", props.quality);
91
+ const canvas = api.getCroppedCanvas();
92
92
  if (props.cropType.toLowerCase() === "base64") {
93
- emit("cropdata", api.getCroppedCanvas().toDataURL("image/jpeg", props.quality));
93
+ emit("cropdata", canvas.toDataURL("image/jpeg", props.quality));
94
94
  } else if (props.cropType.toLowerCase() === "blob") {
95
- let canvas = api.getCroppedCanvas();
96
- canvas.toBlob(
97
- (blobObj) => {
98
- emit("cropdata", blobObj);
99
- },
100
- "image/jpeg",
101
- props.quality
102
- );
95
+ canvas.toBlob((blobObj) => emit("cropdata", blobObj), "image/jpeg", props.quality);
103
96
  }
97
+ api.closeCrop();
104
98
  };
105
99
  const getCroppedCanvas = (state) => () => state.cropper.getCroppedCanvas();
106
100
  const getCropBoxData = (state) => () => state.cropper.getCropBoxData();
@@ -144,7 +138,6 @@ export {
144
138
  clear,
145
139
  closeCrop,
146
140
  closeCropArea,
147
- computedCropImages,
148
141
  createCrop,
149
142
  cropImage,
150
143
  destroy,
@@ -171,7 +164,6 @@ export {
171
164
  setImage,
172
165
  shortcutKeys,
173
166
  showFileChooser,
174
- watchAlt,
175
167
  watchImageSrc,
176
168
  watchVisible,
177
169
  zoom
package/crop/vue.js CHANGED
@@ -5,8 +5,6 @@ import {
5
5
  watchVisible,
6
6
  clear,
7
7
  replace,
8
- computedCropImages,
9
- watchAlt,
10
8
  getCroppedCanvas,
11
9
  setCanvasData,
12
10
  setDragMode,
@@ -66,62 +64,70 @@ const api = [
66
64
  "cropImage",
67
65
  "zoom"
68
66
  ];
69
- const initRenderIcon = (api2) => {
67
+ const initRenderIcon = (api2, t) => {
70
68
  const renderIcon = [
71
69
  {
72
70
  method: () => api2.showFileChooser(),
73
- icon: "IconNew"
71
+ icon: "IconNew",
72
+ title: t("ui.crop.choose")
74
73
  },
74
+ { split: true },
75
75
  {
76
- method: () => api2.zoom(0.1),
77
- icon: "IconZoomIn"
76
+ method: () => api2.zoom(-0.1),
77
+ icon: "IconZoomOut",
78
+ title: t("ui.crop.zoomOut")
78
79
  },
79
80
  {
80
- method: () => api2.zoom(-0.1),
81
- icon: "IconZoomOut"
81
+ method: () => api2.zoom(0.1),
82
+ icon: "IconZoomIn",
83
+ title: t("ui.crop.zoomIn")
82
84
  },
83
85
  {
84
86
  method: () => api2.rotate(-45),
85
- icon: "IconRepeat"
87
+ icon: "IconRepeat",
88
+ title: t("ui.crop.rotate_45")
86
89
  },
87
90
  {
88
91
  method: () => api2.rotate(45),
89
- icon: "IconRefres"
92
+ icon: "IconRefres",
93
+ title: t("ui.crop.rotate45")
90
94
  },
95
+ { split: true },
91
96
  {
92
97
  method: () => api2.closeCropArea(),
93
- icon: "IconCrop"
98
+ icon: "IconCrop",
99
+ title: t("ui.crop.closeCropArea")
94
100
  },
95
101
  {
96
102
  method: () => api2.reset(),
97
- icon: "IconConmentRefresh"
103
+ icon: "IconConmentRefresh",
104
+ title: t("ui.crop.reset")
98
105
  },
106
+ { split: true },
99
107
  {
100
- method: () => api2.cropImage(),
101
- icon: "IconYes"
108
+ method: () => api2.closeCrop(),
109
+ icon: "IconClose",
110
+ title: t("ui.crop.closeCrop")
102
111
  },
103
112
  {
104
- method: () => api2.closeCrop(),
105
- icon: "IconClose"
113
+ method: () => api2.cropImage(),
114
+ icon: "IconYes",
115
+ title: t("ui.crop.cropImage")
106
116
  }
107
117
  ];
108
118
  return renderIcon;
109
119
  };
110
- const initState = ({ reactive, props, computed, api: api2 }) => {
120
+ const initState = ({ reactive, props, api: api2, t }) => {
111
121
  const state = reactive({
112
122
  src: props.src,
113
- cropImg: "",
114
123
  cropper: "",
115
- alt: props.alt,
116
124
  data: null,
117
125
  cropvisible: props.cropvisible,
118
- renderIcon: initRenderIcon(api2),
119
- previewShow: props.previewShow,
120
- cropImages: computed(() => api2.computedCropImages())
126
+ renderIcon: initRenderIcon(api2, t)
121
127
  });
122
128
  return state;
123
129
  };
124
- const initApi = ({ api: api2, state, emit, refs, props, constants, t }) => {
130
+ const initApi = ({ api: api2, state, emit, refs, props }) => {
125
131
  Object.assign(api2, {
126
132
  state,
127
133
  zoom: zoom(state),
@@ -138,7 +144,6 @@ const initApi = ({ api: api2, state, emit, refs, props, constants, t }) => {
138
144
  getData: getData(state),
139
145
  disable: disable(state),
140
146
  destroy: destroy(state),
141
- watchAlt: watchAlt(state),
142
147
  setDragMode: setDragMode(state),
143
148
  getImageData: getImageData(state),
144
149
  watchImageSrc: watchImageSrc(state),
@@ -152,7 +157,7 @@ const initApi = ({ api: api2, state, emit, refs, props, constants, t }) => {
152
157
  getCroppedCanvas: getCroppedCanvas(state),
153
158
  getContainerData: getContainerData(state),
154
159
  createCrop: createCrop({ emit, props, refs, state }),
155
- computedCropImages: computedCropImages({ constants, t }),
160
+ // computedCropImages: computedCropImages({ constants, t }),
156
161
  shortcutKeys: shortcutKeys(api2),
157
162
  closeCropArea: closeCropArea(api2),
158
163
  setImage: setImage({ api: api2, state, props }),
@@ -163,12 +168,11 @@ const initApi = ({ api: api2, state, emit, refs, props, constants, t }) => {
163
168
  const initWatch = ({ watch, props, api: api2 }) => {
164
169
  watch(() => props.cropvisible, api2.watchVisible);
165
170
  watch(() => props.src, api2.watchImageSrc, { immediate: true });
166
- watch(() => props.alt, api2.watchAlt, { immediate: true });
167
171
  };
168
- const renderless = (props, { computed, onMounted, reactive, watch }, { t, emit, refs, constants }) => {
172
+ const renderless = (props, { onMounted, reactive, watch }, { emit, refs, t }) => {
169
173
  const api2 = {};
170
- const state = initState({ reactive, props, computed, api: api2 });
171
- initApi({ api: api2, state, emit, refs, props, constants, t });
174
+ const state = initState({ reactive, props, api: api2, t });
175
+ initApi({ api: api2, state, emit, refs, props });
172
176
  onMounted(api2.createCrop);
173
177
  initWatch({ watch, props, api: api2 });
174
178
  return api2;
@@ -219,8 +219,18 @@ const dateToLocaleStringForIE = (timezone, value) => {
219
219
  const offsetTime = new Date(value).getTime() + offsetTimezone * 36e5;
220
220
  return new Date(offsetTime);
221
221
  };
222
- const changeToNow = ({ api, state }) => () => {
223
- const now = /* @__PURE__ */ new Date();
222
+ const getNowTime = ({ props }) => () => {
223
+ return new Promise((resolve) => {
224
+ resolve(props.nowClick());
225
+ }).then((res) => {
226
+ return res;
227
+ });
228
+ };
229
+ const changeToNow = ({ api, state, props }) => async () => {
230
+ let now = /* @__PURE__ */ new Date();
231
+ if (props.nowClick !== void 0) {
232
+ now = await api.getNowTime();
233
+ }
224
234
  const timezone = state.timezone;
225
235
  const isServiceTimezone = timezone.isServiceTimezone;
226
236
  let disabledDate = !state.disabledDate;
@@ -442,6 +452,7 @@ export {
442
452
  getDefaultValue,
443
453
  getDisabledConfirm,
444
454
  getDisabledNow,
455
+ getNowTime,
445
456
  getRenderTz,
446
457
  getYearLabel,
447
458
  handleClear,
package/date-panel/vue.js CHANGED
@@ -44,7 +44,8 @@ import {
44
44
  computerTimeFormat,
45
45
  watchVisible,
46
46
  getDisabledNow,
47
- getDisabledConfirm
47
+ getDisabledConfirm,
48
+ getNowTime
48
49
  } from "./index";
49
50
  import { getWeekNumber, extractDateFormat } from "../common/deps/date-util";
50
51
  import { DATEPICKER, DATE } from "../common";
@@ -72,9 +73,11 @@ const api = [
72
73
  "handleVisibleDateChange",
73
74
  "handleLeave",
74
75
  "handleShortcutClick",
75
- "handleTimePickClose"
76
+ "handleTimePickClose",
77
+ "getNowTime"
76
78
  ];
77
- const initState = ({ reactive, computed, api: api2, i18n }) => {
79
+ const initState = ({ reactive, computed, api: api2, i18n, designConfig }) => {
80
+ var _a, _b;
78
81
  const state = reactive({
79
82
  popperClass: "",
80
83
  date: /* @__PURE__ */ new Date(),
@@ -118,7 +121,9 @@ const initState = ({ reactive, computed, api: api2, i18n }) => {
118
121
  dateFormat: computed(() => state.format ? extractDateFormat(state.format.replace(state.timefmt, "")) : DATE.Date),
119
122
  lang: computed(() => i18n ? i18n.locale.replace(/_/g, "-") : "zh-CN"),
120
123
  isShowTz: computed(() => state.showTimezone && state.showTime),
121
- isShowFooter: computed(() => state.footerVisible && [DATEPICKER.Date, DATEPICKER.Year].includes(state.currentView))
124
+ isShowFooter: computed(() => state.footerVisible && [DATEPICKER.Date, DATEPICKER.Year].includes(state.currentView)),
125
+ buttonType: ((_a = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _a.buttonType) || "default",
126
+ buttonSize: ((_b = designConfig == null ? void 0 : designConfig.state) == null ? void 0 : _b.buttonSize) || "default"
122
127
  });
123
128
  state.needChangeTimezoneData = true;
124
129
  return state;
@@ -150,7 +155,7 @@ const initWatch = ({ watch, state, api: api2, nextTick }) => {
150
155
  );
151
156
  watch(() => state.visible, api2.watchVisible);
152
157
  };
153
- const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch }) => {
158
+ const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch, props }) => {
154
159
  Object.assign(api2, {
155
160
  t,
156
161
  state,
@@ -181,7 +186,7 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch }) => {
181
186
  searchTz: searchTz({ api: api2, state }),
182
187
  handleEnter: handleEnter(api2),
183
188
  handleLeave: handleLeave({ api: api2, emit }),
184
- changeToNow: changeToNow({ api: api2, state }),
189
+ changeToNow: changeToNow({ api: api2, state, props }),
185
190
  isValidValue: isValidValue({ api: api2, state }),
186
191
  handleClear: handleClear({ api: api2, state, emit }),
187
192
  watchValue: watchValue({ api: api2, state }),
@@ -198,14 +203,15 @@ const initApi = ({ api: api2, state, t, emit, nextTick, vm, watch }) => {
198
203
  handleVisibleTimeChange: handleVisibleTimeChange({ api: api2, vm, state, t }),
199
204
  computerTimeFormat: computerTimeFormat({ state }),
200
205
  getDisabledNow: getDisabledNow({ state }),
201
- getDisabledConfirm: getDisabledConfirm({ state })
206
+ getDisabledConfirm: getDisabledConfirm({ state }),
207
+ getNowTime: getNowTime({ props })
202
208
  });
203
209
  };
204
- const renderless = (props, { computed, reactive, watch, nextTick }, { t, emit: $emit, vm, i18n }) => {
210
+ const renderless = (props, { computed, reactive, watch, nextTick }, { t, emit: $emit, vm, i18n, designConfig }) => {
205
211
  const api2 = {};
206
212
  const emit = props.emitter ? props.emitter.emit : $emit;
207
- const state = initState({ reactive, computed, api: api2, i18n });
208
- initApi({ api: api2, state, t, emit, nextTick, vm, watch });
213
+ const state = initState({ reactive, computed, api: api2, i18n, designConfig });
214
+ initApi({ api: api2, state, t, emit, nextTick, vm, watch, props });
209
215
  initWatch({ watch, state, api: api2, nextTick });
210
216
  return api2;
211
217
  };
@@ -240,8 +240,8 @@ const handleDrag = ({
240
240
  document.onmouseup = () => {
241
241
  document.onmousemove = demMousemove;
242
242
  document.onmouseup = demMouseup;
243
+ props.draggable && state.move && emit("drag-end", event);
243
244
  state.move = false;
244
- props.draggable && emit("drag-end", event);
245
245
  };
246
246
  };
247
247
  const showScrollbar = (lockScrollClass) => () => {