@opentiny/vue-renderless 3.8.3 → 3.8.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.
@@ -22,7 +22,7 @@ const setSheetStyle = ({ state, props }) => () => {
22
22
  const initScrollMenu = ({ state, nextTick, refs, BScroll }) => () => {
23
23
  nextTick(() => {
24
24
  const { scrollMenu } = refs;
25
- if (state.scroll) {
25
+ if (!state.scroll) {
26
26
  state.scroll = new BScroll(scrollMenu, {
27
27
  probeType: 3,
28
28
  tap: "tap"
@@ -1,6 +1,6 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { setSheetStyle, initScrollMenu, visibleHandle, watchVisible, menuHandle, close, selectOption, confirm, actionSelectOption, hide } from "./index";
3
- const api = ["state", "setSheetStyle", "initScrollMenu", "visibleHandle", "menuHandle", "close", "selectOption", "confirm", "actionSelectOption", "hide"];
3
+ const api = ["state", "setSheetStyle", "initScrollMenu", "visibleHandle", "watchVisible", "menuHandle", "close", "selectOption", "confirm", "actionSelectOption", "hide"];
4
4
  const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, { BScroll }) => {
5
5
  const api2 = {};
6
6
  const state = reactive({
@@ -10,17 +10,6 @@ const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, {
10
10
  sheetContentStyle: {},
11
11
  scroll: null
12
12
  });
13
- watch(
14
- () => props.visible,
15
- (value) => {
16
- if (value) {
17
- api2.setSheetStyle({ state, props });
18
- api2.initScrollMenu({ state, nextTick, refs, BScroll });
19
- }
20
- api2.watchVisible(value);
21
- }
22
- );
23
- watch(() => props.visible, api2.watchVisible, { immediate: true });
24
13
  Object.assign(api2, {
25
14
  state,
26
15
  setSheetStyle: setSheetStyle({ state, props }),
@@ -34,6 +23,17 @@ const renderless = (props, { reactive, watch }, { emit, nextTick, refs, vm }, {
34
23
  close: close({ emit, vm }),
35
24
  hide: hide(emit)
36
25
  });
26
+ watch(
27
+ () => props.visible,
28
+ (value) => {
29
+ if (value) {
30
+ api2.setSheetStyle({ state, props });
31
+ api2.initScrollMenu({ state, nextTick, refs, BScroll });
32
+ }
33
+ api2.watchVisible(value);
34
+ }
35
+ );
36
+ watch(() => props.visible, api2.watchVisible, { immediate: true });
37
37
  return api2;
38
38
  };
39
39
  export {
package/anchor/index.js CHANGED
@@ -22,9 +22,7 @@ const setScrollContainer = ({ state, api, cb = null }) => {
22
22
  const currentContainer = api.getContainer();
23
23
  const { scrollContainer } = state;
24
24
  if (scrollContainer !== currentContainer) {
25
- removeClass(scrollContainer, "tiny-anchor-scroll-container");
26
25
  state.scrollContainer = currentContainer;
27
- addClass(currentContainer, "tiny-anchor-scroll-container");
28
26
  cb && cb();
29
27
  }
30
28
  };
@@ -51,7 +49,7 @@ const updateSkidPosition = ({ vm, state, emit }) => {
51
49
  }
52
50
  };
53
51
  const getCurrentAnchor = ({ vm, state, link, emit }) => {
54
- if (state.currentLink === link) {
52
+ if (state.currentLink === link || state.isScroll) {
55
53
  return;
56
54
  }
57
55
  state.currentLink = link;
@@ -80,6 +78,13 @@ const setCurrentHash = (state) => {
80
78
  }
81
79
  return false;
82
80
  };
81
+ const handleScroll = (state) => {
82
+ clearTimeout(state.scrollTimer);
83
+ state.scrollTimer = setTimeout(() => {
84
+ state.isScroll = false;
85
+ clearTimeout(state.scrollTimer);
86
+ }, 500);
87
+ };
83
88
  const getContainer = ({ props }) => () => props.containerId ? document.querySelector(props.containerId) : document.body;
84
89
  const mounted = ({ vm, state, api }) => () => {
85
90
  setScrollContainer({ state, api });
@@ -94,6 +99,7 @@ const updated = ({ state, api }) => () => {
94
99
  const unmounted = ({ state }) => () => {
95
100
  const { intersectionObserver } = state;
96
101
  intersectionObserver.disconnect();
102
+ state.scrollContainer.removeEventListener("scroll", handleScroll(state));
97
103
  };
98
104
  const onItersectionObserver = ({ vm, state, props, emit }) => () => {
99
105
  const { expandLink, scrollContainer } = state;
@@ -121,6 +127,7 @@ const onItersectionObserver = ({ vm, state, props, emit }) => () => {
121
127
  addObserver({ props, state });
122
128
  };
123
129
  const linkClick = ({ state, vm, emit, props }) => (e, item) => {
130
+ state.isScroll = true;
124
131
  const { link, title } = item;
125
132
  const emitLink = { link, title };
126
133
  emit("linkClick", e, emitLink);
@@ -131,9 +138,10 @@ const linkClick = ({ state, vm, emit, props }) => (e, item) => {
131
138
  setMarkClass({ state, props });
132
139
  if (scrollContainer !== document.body && !isChangeHash) {
133
140
  const linkEl = scrollContainer.querySelector(item.link);
134
- const top = linkEl.offsetTop;
141
+ const top = linkEl.offsetTop - scrollContainer.offsetTop;
135
142
  const param = { top, left: 0, behavior: "smooth" };
136
143
  scrollContainer.scrollTo(param);
144
+ scrollContainer.addEventListener("scroll", handleScroll(state));
137
145
  }
138
146
  };
139
147
  export {
package/anchor/vue.js CHANGED
@@ -9,7 +9,9 @@ const renderless = (props, { onMounted, onUnmounted, onUpdated, reactive }, { vm
9
9
  expandLink: {},
10
10
  intersectionObserver: null,
11
11
  scrollContainer: null,
12
- currentHash: ""
12
+ currentHash: "",
13
+ isScroll: false,
14
+ scrollTimer: null
13
15
  });
14
16
  Object.assign(api2, {
15
17
  state,
@@ -1,7 +1,7 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { handleClick, moreNodeClick } from "./index";
3
3
  const api = ["state", "handleClick", "moreNodeClick"];
4
- function renderless(props, { computed, reactive, watch, inject }, { emit, parent }) {
4
+ const renderless = (props, { computed, reactive, watch, inject }, { emit, parent }) => {
5
5
  var _a, _b;
6
6
  parent.tinyForm = parent.tinyForm || inject("form", null);
7
7
  const state = reactive({
@@ -32,7 +32,7 @@ function renderless(props, { computed, reactive, watch, inject }, { emit, parent
32
32
  moreNodeClick: moreNodeClick({ emit, props, state })
33
33
  };
34
34
  return api2;
35
- }
35
+ };
36
36
  export {
37
37
  api,
38
38
  renderless
package/common/index.js CHANGED
@@ -251,7 +251,7 @@ const EDOC = {
251
251
  constants: 320,
252
252
  twenty: 20
253
253
  };
254
- const version = "3.8.3";
254
+ const version = "3.8.5";
255
255
  const log = (data, type = "log") => {
256
256
  uLog.logger[type](data);
257
257
  };
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.8.3";
25
+ const version = "3.8.5";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -2,6 +2,7 @@ import {
2
2
  __spreadValues
3
3
  } from "../../chunk-PKUHTIDK.js";
4
4
  import { hasOwn, isNull } from "../type";
5
+ import { log } from "../xss";
5
6
  const formatRegExp = /%[sdj%]/g;
6
7
  let warning = () => void 0;
7
8
  function convertFieldsError(errors) {
@@ -138,7 +139,7 @@ function asyncMap(objArray, option, func, callback) {
138
139
  const flattenArr = flattenObjArr(objArray);
139
140
  asyncSerialArray(flattenArr, func, next);
140
141
  });
141
- pending2.catch((error) => error);
142
+ pending2.catch((error) => log.logger.error(error));
142
143
  return pending2;
143
144
  }
144
145
  let firstFields = option.firstFields || [];
@@ -168,7 +169,7 @@ function asyncMap(objArray, option, func, callback) {
168
169
  }
169
170
  });
170
171
  });
171
- pending.catch((e) => e);
172
+ pending.catch((error) => log.logger.error(error));
172
173
  return pending;
173
174
  }
174
175
  function complementError(rule) {
@@ -3,7 +3,7 @@ import { omitText } from "../common/string";
3
3
  const api = ["dataStore", "handleClick", "dataStore", "mouseEnter", "mouseLeave"];
4
4
  const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
5
5
  const api2 = {};
6
- const dropdownMenuVm = inject("dropdownMenuVm");
6
+ const dropdownMenuVm = inject("dropdownMenu");
7
7
  const multiStage = inject("multiStage");
8
8
  let dataStore = reactive({
9
9
  checkedStatus: dropdownMenuVm.checkedStatus,
@@ -535,7 +535,6 @@ const handleRemove = ({ api, emit, props, state, constants }) => (file, raw) =>
535
535
  file = api.getFile(raw);
536
536
  }
537
537
  let doRemove = () => {
538
- file.status = constants.FILE_STATUS.FAIL;
539
538
  api.abort(file);
540
539
  let fileList = state.uploadFiles;
541
540
  fileList.splice(fileList.indexOf(file), 1);
@@ -40,6 +40,7 @@ function setBasicProperty(column, context) {
40
40
  column.treeNode = context.treeNode;
41
41
  column.renderer = context.renderer;
42
42
  column.editor = context.editor;
43
+ column.operationConfig = context.operationConfig;
43
44
  }
44
45
  function ColumnConfig(context, { renderHeader, renderCell, renderData } = {}, config = {}) {
45
46
  setBasicProperty(this, context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.8.3",
3
+ "version": "3.8.4",
4
4
  "description": "An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.",
5
5
  "homepage": "https://opentiny.design/tiny-vue",
6
6
  "keywords": [
package/pager/vue.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  const api = [];
3
- function renderless() {
3
+ const renderless = () => {
4
4
  const api2 = {};
5
5
  return api2;
6
- }
6
+ };
7
7
  export {
8
8
  api,
9
9
  renderless
package/switch/vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { toggle, computedWarpClasses, computedInnerClasses, computedStyle } from "./index";
3
3
  const api = ["toggle", "state"];
4
- const renderless = (props, { computed, watch, reactive, inject }, { parent, constants, mode, emit }) => {
4
+ const renderless = (props, { computed, watch, reactive, inject }, { parent, constants, mode, emit, designConfig }) => {
5
5
  const prefixCls = constants.prefixcls(mode);
6
6
  parent.tinyForm = parent.tinyForm || inject("form", null);
7
7
  const api2 = {
@@ -14,7 +14,14 @@ const renderless = (props, { computed, watch, reactive, inject }, { parent, cons
14
14
  style: computed(() => api2.computedStyle()),
15
15
  formDisabled: computed(() => (parent.tinyForm || {}).disabled),
16
16
  disabled: computed(() => props.disabled || state.formDisabled),
17
- isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly)
17
+ isDisplayOnly: computed(() => props.displayOnly || (parent.tinyForm || {}).displayOnly),
18
+ showText: computed(() => {
19
+ if (props.showText === void 0) {
20
+ return (designConfig == null ? void 0 : designConfig.showText) || false;
21
+ } else {
22
+ return props.showText;
23
+ }
24
+ })
18
25
  });
19
26
  Object.assign(api2, {
20
27
  state,