@opentiny/vue-renderless 3.14.0 → 3.15.0

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 (106) hide show
  1. package/LICENSE +22 -0
  2. package/action-menu/index.js +44 -0
  3. package/action-menu/vue.js +25 -8
  4. package/calendar-view/index.js +21 -13
  5. package/calendar-view/vue.js +6 -3
  6. package/cascader/index.js +1 -1
  7. package/cascader-select/index.js +5 -0
  8. package/cascader-select/vue.js +3 -1
  9. package/common/bigInt.js +2 -2
  10. package/common/deps/date-util.js +4 -2
  11. package/common/deps/vue-popper.js +22 -2
  12. package/common/index.js +15 -2
  13. package/common/runtime.js +1 -1
  14. package/date-range/vue.js +1 -0
  15. package/date-table/index.js +30 -53
  16. package/date-table/vue.js +1 -1
  17. package/dept/index.js +8 -1
  18. package/dept/vue.js +10 -1
  19. package/dialog-box/index.js +12 -6
  20. package/dialog-box/vue.js +1 -1
  21. package/dropdown-item/mf.js +2 -2
  22. package/file-upload/index.js +0 -1
  23. package/grid/utils/dom.js +30 -10
  24. package/image/index.js +4 -0
  25. package/image/vue.js +6 -3
  26. package/image-viewer/vue.js +3 -1
  27. package/input/index.js +6 -1
  28. package/input/vue.js +9 -5
  29. package/modal/index.js +1 -1
  30. package/numeric/index.js +9 -20
  31. package/numeric/vue.js +3 -12
  32. package/option-group/index.js +13 -0
  33. package/option-group/vue.js +19 -6
  34. package/package.json +7 -7
  35. package/picker/index.js +218 -193
  36. package/picker/vue.js +7 -4
  37. package/popconfirm/index.js +6 -0
  38. package/popconfirm/vue.js +11 -3
  39. package/popeditor/index.js +2 -2
  40. package/popover/index.js +4 -1
  41. package/popover/vue.js +2 -1
  42. package/quarter-panel/index.js +61 -0
  43. package/quarter-panel/vue.js +46 -0
  44. package/select/index.js +111 -55
  45. package/select/vue.js +53 -19
  46. package/skeleton/vue.js +2 -2
  47. package/skeleton-item/vue.js +1 -1
  48. package/statistic/index.js +22 -0
  49. package/statistic/vue.js +20 -0
  50. package/tabs/index.js +16 -1
  51. package/tall-storage/index.js +1 -1
  52. package/time-picker-mobile/index.js +10 -1
  53. package/time-picker-mobile/vue.js +5 -3
  54. package/time-spinner/index.js +52 -1
  55. package/time-spinner/vue.js +4 -2
  56. package/timeline-item/index.js +14 -1
  57. package/timeline-item/vue.js +7 -4
  58. package/tree/index.js +8 -4
  59. package/tree/vue.js +3 -3
  60. package/tree-node/index.js +2 -2
  61. package/types/action-menu.type.d.ts +40 -12
  62. package/types/action-sheet.type.d.ts +2 -2
  63. package/types/alert.type.d.ts +1 -1
  64. package/types/checkbox.type.d.ts +3 -3
  65. package/types/collapse.type.d.ts +1 -1
  66. package/types/date-table.type.d.ts +13 -0
  67. package/types/dialog-box.type.d.ts +1 -1
  68. package/types/drawer.type.d.ts +1 -1
  69. package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
  70. package/types/dropdown-item.type.d.ts +1 -1
  71. package/types/dropdown-menu.type.d.ts +1 -1
  72. package/types/file-upload.type.d.ts +1 -1
  73. package/types/form-item.type.d.ts +1 -1
  74. package/types/{form.type-222799ae.d.ts → form.type-8e30b25c.d.ts} +2 -1
  75. package/types/form.type.d.ts +1 -1
  76. package/types/image.type.d.ts +4 -0
  77. package/types/input.type.d.ts +3 -1
  78. package/types/milestone.type.d.ts +1 -1
  79. package/types/numeric.type.d.ts +4 -5
  80. package/types/pager.type.d.ts +1 -1
  81. package/types/popconfirm.type.d.ts +8 -0
  82. package/types/popeditor.type.d.ts +1 -1
  83. package/types/popover.type.d.ts +3 -3
  84. package/types/progress.type.d.ts +1 -1
  85. package/types/skeleton.type.d.ts +1 -1
  86. package/types/statistic.type.d.ts +56 -0
  87. package/types/steps.type.d.ts +1 -1
  88. package/types/switch.type.d.ts +3 -3
  89. package/types/tag.type.d.ts +4 -1
  90. package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
  91. package/types/time-line.type.d.ts +1 -1
  92. package/types/timeline-item.type.d.ts +1 -1
  93. package/types/transfer.type.d.ts +3 -3
  94. package/types/upload-dragger.type.d.ts +2 -2
  95. package/types/{upload-list.type-a29aea50.d.ts → upload-list.type-f34997c8.d.ts} +9 -5
  96. package/types/upload-list.type.d.ts +1 -1
  97. package/types/upload.type.d.ts +1 -1
  98. package/user/index.js +1 -1
  99. package/credit-card/index.js +0 -93
  100. package/credit-card/vue.js +0 -62
  101. package/credit-card-form/index.js +0 -112
  102. package/credit-card-form/vue.js +0 -119
  103. package/detail-page/index.js +0 -79
  104. package/detail-page/vue.js +0 -78
  105. package/slide-bar/index.js +0 -67
  106. package/slide-bar/vue.js +0 -32
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -1,4 +1,44 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ const computedMaxShowNum = ({ props, state }) => () => {
3
+ if (props.maxShowNum !== void 0) {
4
+ return props.maxShowNum;
5
+ }
6
+ if (state.isCardMode) {
7
+ return 3;
8
+ } else {
9
+ return 2;
10
+ }
11
+ };
12
+ const computedSpacing = ({ props, state }) => () => {
13
+ if (props.spacing !== void 0) {
14
+ return String(props.spacing).includes("px") ? props.spacing : props.spacing + "px";
15
+ }
16
+ if (state.isCardMode) {
17
+ return "10px";
18
+ } else {
19
+ return "5px";
20
+ }
21
+ };
22
+ const computedMoreText = ({ props, state, t }) => () => {
23
+ if (props.moreText !== void 0) {
24
+ return props.moreText;
25
+ }
26
+ if (state.isCardMode) {
27
+ return "";
28
+ } else {
29
+ return t("ui.actionMenu.moreText");
30
+ }
31
+ };
32
+ const computedSuffixIcon = ({ props, state }) => () => {
33
+ if (props.suffixIcon) {
34
+ return props.suffixIcon;
35
+ }
36
+ if (state.isCardMode) {
37
+ return "tiny-icon-ellipsis";
38
+ } else {
39
+ return "";
40
+ }
41
+ };
2
42
  const handleMoreClick = (emit) => () => {
3
43
  emit("more-click");
4
44
  };
@@ -9,6 +49,10 @@ const visibleChange = (emit) => (status) => {
9
49
  emit("visible-change", status);
10
50
  };
11
51
  export {
52
+ computedMaxShowNum,
53
+ computedMoreText,
54
+ computedSpacing,
55
+ computedSuffixIcon,
12
56
  handleItemClick,
13
57
  handleMoreClick,
14
58
  visibleChange
@@ -1,18 +1,35 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleMoreClick, handleItemClick, visibleChange } from "./index";
2
+ import {
3
+ handleMoreClick,
4
+ handleItemClick,
5
+ visibleChange,
6
+ computedMaxShowNum,
7
+ computedSpacing,
8
+ computedMoreText,
9
+ computedSuffixIcon
10
+ } from "./index";
3
11
  const api = ["state", "handleMoreClick", "handleItemClick", "visibleChange"];
4
- const renderless = (props, { computed, reactive }, { emit }) => {
12
+ const renderless = (props, { computed, reactive }, { emit, t }) => {
13
+ const api2 = {};
5
14
  const state = reactive({
6
- visibleOptions: computed(() => props.options.slice(0, props.maxShowNum)),
7
- moreOptions: computed(() => props.options.slice(props.maxShowNum)),
8
- spacing: computed(() => String(props.spacing).includes("px") ? props.spacing : props.spacing + "px")
15
+ visibleOptions: computed(() => props.options.slice(0, state.maxShowNum)),
16
+ isCardMode: computed(() => props.mode === "card"),
17
+ moreOptions: computed(() => props.options.slice(state.maxShowNum)),
18
+ spacing: computed(() => api2.computedSpacing()),
19
+ maxShowNum: computed(() => api2.computedMaxShowNum()),
20
+ moreText: computed(() => api2.computedMoreText()),
21
+ suffixIcon: computed(() => api2.computedSuffixIcon())
9
22
  });
10
- const api2 = {
23
+ Object.assign(api2, {
24
+ state,
11
25
  handleMoreClick: handleMoreClick(emit),
12
26
  handleItemClick: handleItemClick(emit),
13
27
  visibleChange: visibleChange(emit),
14
- state
15
- };
28
+ computedMaxShowNum: computedMaxShowNum({ props, state }),
29
+ computedSpacing: computedSpacing({ props, state }),
30
+ computedMoreText: computedMoreText({ props, state, t }),
31
+ computedSuffixIcon: computedSuffixIcon({ props, state })
32
+ });
16
33
  return api2;
17
34
  };
18
35
  export {
@@ -125,23 +125,30 @@ const handleEvents = ({ props, state }) => () => {
125
125
  props.events.forEach((prop) => {
126
126
  const item = __spreadValues({}, prop);
127
127
  const {
128
- year,
129
- month,
128
+ year: startYear,
129
+ month: startMonth,
130
130
  day: startDay,
131
131
  hours: startHours,
132
132
  minutes: startMinutes,
133
133
  seconds: startSeconds
134
134
  } = parseDate(item.start);
135
- const { day: endDay, hours: endHours, minutes: endMinutes, seconds: endSeconds } = parseDate(item.end);
136
- if ([lastYear, +state.activeYear, nextYear].includes(year) && [lastMon, +state.activeMonth, nextMon].includes(month)) {
135
+ const {
136
+ year: endYear,
137
+ month: endMonth,
138
+ day: endDay,
139
+ hours: endHours,
140
+ minutes: endMinutes,
141
+ seconds: endSeconds
142
+ } = parseDate(item.end);
143
+ if ([lastYear, +state.activeYear, nextYear].includes(startYear) && [lastMon, +state.activeMonth, nextMon].includes(startMonth) || [lastYear, +state.activeYear, nextYear].includes(endYear) && [lastMon, +state.activeMonth, nextMon].includes(endMonth)) {
137
144
  item.start = getTime(item.start);
138
145
  item.end = getTime(item.end);
139
146
  item.startTime = makeUpZero(startHours) + ":" + makeUpZero(startMinutes) + ":" + makeUpZero(startSeconds);
140
147
  item.endTime = makeUpZero(endHours) + ":" + makeUpZero(endMinutes) + ":" + makeUpZero(endSeconds);
141
- item.startDay = year + "-" + month + "-" + startDay;
142
- item.endDay = year + "-" + month + "-" + endDay;
143
- const startTimestamp = getTime(year + "-" + month + "-" + startDay);
144
- const endTimestamp = getTime(year + "-" + month + "-" + endDay);
148
+ item.startDay = startYear + "-" + startMonth + "-" + startDay;
149
+ item.endDay = endYear + "-" + endMonth + "-" + endDay;
150
+ const startTimestamp = getTime(startYear + "-" + startMonth + "-" + startDay);
151
+ const endTimestamp = getTime(endYear + "-" + endMonth + "-" + endDay);
145
152
  const days = Math.abs(endTimestamp - startTimestamp) / dayMillisecond;
146
153
  item.dayNumber = days >= 1 ? days + 1 : 1;
147
154
  if (props.modes.includes("timeline")) {
@@ -158,19 +165,20 @@ const handleEvents = ({ props, state }) => () => {
158
165
  function splitEvent(props, event) {
159
166
  const result = [];
160
167
  const startDay = new Date(event.startDay);
161
- const day = startDay.getDate();
168
+ const dayMillisecond = 24 * 60 * 60 * 1e3;
162
169
  if (event.dayNumber > 1) {
163
170
  for (let i = 0; i < event.dayNumber; i++) {
164
171
  let copyObj = JSON.parse(JSON.stringify(event));
172
+ let dayStartTimeStamp = new Date(startDay.getTime() + i * dayMillisecond);
165
173
  if (i === 0) {
166
174
  copyObj.realStart = copyObj.start;
167
- copyObj.realEnd = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[1]);
175
+ copyObj.realEnd = new Date(dayStartTimeStamp).setHours(props.dayTimes[1]);
168
176
  } else if (i === event.dayNumber - 1) {
169
- copyObj.realStart = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[0]);
177
+ copyObj.realStart = new Date(dayStartTimeStamp).setHours(props.dayTimes[0]);
170
178
  copyObj.realEnd = copyObj.end;
171
179
  } else {
172
- copyObj.realStart = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[0]);
173
- copyObj.realEnd = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[1]);
180
+ copyObj.realStart = new Date(dayStartTimeStamp).setHours(props.dayTimes[0]);
181
+ copyObj.realEnd = new Date(dayStartTimeStamp).setHours(props.dayTimes[1]);
174
182
  }
175
183
  result.push(copyObj);
176
184
  }
@@ -149,9 +149,12 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
149
149
  { immediate: true, deep: true }
150
150
  );
151
151
  watch(
152
- () => props.mode,
153
- () => {
154
- state.mode = props.mode;
152
+ () => state.mode,
153
+ (val) => {
154
+ emit("mode-change", val);
155
+ if (val === "timeline") {
156
+ api2.getCurWeekEvent();
157
+ }
155
158
  }
156
159
  );
157
160
  watch(
package/cascader/index.js CHANGED
@@ -217,7 +217,7 @@ const handleExpandChange = ({ constants, dispatch, emit, nextTick, state, update
217
217
  dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
218
218
  state.multiple ? state.presentText : state.inputValue
219
219
  ]);
220
- updatePopper(state.panel.$parent.$el);
220
+ updatePopper();
221
221
  });
222
222
  emit("expand-change", value);
223
223
  emit("active-item-change", value);
@@ -29,6 +29,10 @@ const confirm = ({ api, emit, defaultValues, selectedOptions, isDisabled, vm })
29
29
  emit("update:modelValue", defaultValues.value.slice());
30
30
  api.close();
31
31
  };
32
+ const clear = ({ api, emit }) => (value) => {
33
+ emit("update:modelValue", value);
34
+ api.close();
35
+ };
32
36
  const columnStyle = ({ props, computed }) => computed(() => {
33
37
  return {
34
38
  height: `${+props.visibleOptionNum * +props.optionHeight}px`,
@@ -36,6 +40,7 @@ const columnStyle = ({ props, computed }) => computed(() => {
36
40
  };
37
41
  });
38
42
  export {
43
+ clear,
39
44
  close,
40
45
  columnStyle,
41
46
  confirm,
@@ -1,10 +1,11 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { watchActionSheetVisible, close, confirm, columnStyle } from "./index";
2
+ import { watchActionSheetVisible, close, confirm, columnStyle, clear } from "./index";
3
3
  import { usePicker } from "./usePicker";
4
4
  const api = [
5
5
  "state",
6
6
  "close",
7
7
  "confirm",
8
+ "clear",
8
9
  "columnsType",
9
10
  "columnsList",
10
11
  "columnFieldNames",
@@ -34,6 +35,7 @@ const renderless = (props, { reactive, computed, watch, ref, toRefs }, { emit, v
34
35
  };
35
36
  Object.assign(api2, {
36
37
  close: close(state),
38
+ clear: clear({ api: api2, emit }),
37
39
  confirm: confirm({ api: api2, emit, props, state, defaultValues, selectedOptions, isDisabled, vm }),
38
40
  watchActionSheetVisible: watchActionSheetVisible({ emit, api: api2, props }),
39
41
  columnsType,
package/common/bigInt.js CHANGED
@@ -119,7 +119,7 @@ class BigIntDecimal {
119
119
  const f = Function;
120
120
  const convertBigInt = (str) => {
121
121
  const validStr = str.replace(/^0+/, "") || "0";
122
- return f(`return BigInt(${validStr})`)();
122
+ return f(`return BigInt('${validStr}')`)();
123
123
  };
124
124
  if (validateNumber(mergedValue)) {
125
125
  const trimRet = trimNumber(mergedValue);
@@ -127,7 +127,7 @@ class BigIntDecimal {
127
127
  const numbers = trimRet.trimStr.split(".");
128
128
  this.integer = !numbers[0].includes("e") ? BigInt(numbers[0]) : numbers[0];
129
129
  const decimalStr = numbers[1] || "0";
130
- this.decimal = convertBigInt(decimalStr);
130
+ this.decimal = decimalStr.includes("e") ? convertBigInt(decimalStr) : BigInt(decimalStr);
131
131
  this.decimalLen = decimalStr.length;
132
132
  } else {
133
133
  this.nan = true;
@@ -60,10 +60,12 @@ const getFirstDayOfMonth = (date) => {
60
60
  };
61
61
  const prevDate = (date, amount = 1) => new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
62
62
  const nextDate = (date, amount = 1) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
63
- const getStartDateOfMonth = (year, month) => {
63
+ const getStartDateOfMonth = (year, month, offsetDay = 0) => {
64
64
  const res = new Date(year, month, 1);
65
65
  const day = res.getDay();
66
- return day === 0 ? prevDate(res, 7) : prevDate(res, day);
66
+ const _day = day === 0 ? 7 : day;
67
+ const offset = _day + offsetDay <= 0 ? 7 + _day : _day;
68
+ return prevDate(res, offset);
67
69
  };
68
70
  const getWeekNumber = (src) => {
69
71
  if (!isDate(src)) {
@@ -14,6 +14,23 @@ const getReference = ({ state, props, vm, slots }) => {
14
14
  }
15
15
  return reference;
16
16
  };
17
+ const getReferMaxZIndex = (reference) => {
18
+ if (!reference || !reference.nodeType)
19
+ return;
20
+ let getZIndex = (dom) => parseInt(window.getComputedStyle(dom).zIndex, 10) || 0;
21
+ let max = getZIndex(reference);
22
+ let z;
23
+ do {
24
+ reference = reference.parentNode;
25
+ if (reference) {
26
+ z = getZIndex(reference);
27
+ } else {
28
+ break;
29
+ }
30
+ max = z > max ? z : max;
31
+ } while (reference !== document.body);
32
+ return max + 1 + "";
33
+ };
17
34
  var vue_popper_default = (options) => {
18
35
  const {
19
36
  parent,
@@ -55,6 +72,9 @@ var vue_popper_default = (options) => {
55
72
  popper.style.display = "none";
56
73
  }
57
74
  };
75
+ const nextZIndex = (reference) => {
76
+ return props.zIndex === "relative" ? getReferMaxZIndex(reference) : PopupManager.nextZIndex();
77
+ };
58
78
  const createPopper = (dom) => {
59
79
  if (isServer) {
60
80
  return;
@@ -89,7 +109,7 @@ var vue_popper_default = (options) => {
89
109
  if (typeof options2.onUpdate === "function") {
90
110
  state.popperJS.onUpdate(options2.onUpdate);
91
111
  }
92
- state.popperJS._popper.style.zIndex = PopupManager.nextZIndex().toString();
112
+ state.popperJS._popper.style.zIndex = nextZIndex(state.popperJS._reference);
93
113
  followHide(state.popperJS);
94
114
  on(state.popperElm, "click", stop);
95
115
  };
@@ -101,7 +121,7 @@ var vue_popper_default = (options) => {
101
121
  if (popperJS) {
102
122
  popperJS.update();
103
123
  if (popperJS._popper && popperElmOrTrue !== true) {
104
- popperJS._popper.style.zIndex = PopupManager.nextZIndex().toString();
124
+ popperJS._popper.style.zIndex = nextZIndex(popperJS._reference);
105
125
  followHide(state.popperJS);
106
126
  }
107
127
  } else {
package/common/index.js CHANGED
@@ -109,7 +109,7 @@ const DATE = {
109
109
  Time: "hh:mm",
110
110
  YearMonth: "yyyy-MM"
111
111
  };
112
- const TriggerTypes = "date,datetime,time,time-select,week,month,year,years,yearrange,daterange,monthrange,timerange,datetimerange,dates";
112
+ const TriggerTypes = "date,datetime,time,time-select,week,month,year,years,yearrange,daterange,monthrange,timerange,datetimerange,dates,quarter";
113
113
  const DATEPICKER = {
114
114
  Day: "day",
115
115
  Date: "date",
@@ -147,6 +147,18 @@ const DATEPICKER = {
147
147
  center: "bottom",
148
148
  right: "bottom-end"
149
149
  },
150
+ QuarterMap: {
151
+ 0: 0,
152
+ 1: 3,
153
+ 2: 6,
154
+ 3: 9
155
+ },
156
+ MonthQuarterMap: {
157
+ 0: 1,
158
+ 3: 2,
159
+ 6: 3,
160
+ 9: 4
161
+ },
150
162
  TriggerTypes: TriggerTypes.split(","),
151
163
  DateFormats: {
152
164
  year: "yyyy",
@@ -164,6 +176,7 @@ const DATEPICKER = {
164
176
  },
165
177
  Time: "time",
166
178
  TimeRange: "timerange",
179
+ Quarter: "quarter",
167
180
  IconTime: "icon-time",
168
181
  IconDate: "icon-Calendar",
169
182
  DateRange: "daterange",
@@ -224,7 +237,7 @@ const CASCADER = {
224
237
  PropsHover: "hoverThreshold",
225
238
  MenuConnector: "cascader-menu-"
226
239
  };
227
- const version = "3.14.0";
240
+ const version = "3.15.0";
228
241
  const log = (data, type = "log") => {
229
242
  uLog.logger[type](data);
230
243
  };
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.14.0";
25
+ const version = "3.15.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/date-range/vue.js CHANGED
@@ -117,6 +117,7 @@ const initState = ({ reactive, computed, api: api2, constants, designConfig }) =
117
117
  dateFormat: computed(() => state.format ? extractDateFormat(state.format) : "yyyy-MM-dd"),
118
118
  enableMonthArrow: computed(() => api2.getEnableMonthArrow()),
119
119
  enableYearArrow: computed(() => api2.computerEnableYearArrow()),
120
+ // tiny 新增
120
121
  confirmButtonProps: __spreadValues({
121
122
  plain: true,
122
123
  type: "default"
@@ -11,7 +11,7 @@ import {
11
11
  } from "../common/deps/date-util";
12
12
  import { DATEPICKER } from "../common";
13
13
  const formatJudg = ({ day, offset, j, i, cell, count, dateCountOfLastMonth }) => {
14
- const nodfpm = day + offset < 0 ? 7 + day + offset : day + offset;
14
+ const nodfpm = day + offset <= 0 ? 7 + day + offset : day + offset;
15
15
  if (j + i * 7 >= nodfpm) {
16
16
  cell.text = count++;
17
17
  } else {
@@ -36,19 +36,7 @@ const getDateTimestamp = (time) => {
36
36
  }
37
37
  return NaN;
38
38
  };
39
- const arrayFindIndex = (arr, pred) => {
40
- for (let i = 0, len = arr.length; i !== len; ++i) {
41
- if (pred(arr[i])) {
42
- return i;
43
- }
44
- }
45
- return -1;
46
- };
47
- const arrayFind = (arr, pred) => {
48
- const idx = arrayFindIndex(arr, pred);
49
- return ~idx ? arr[idx] : void 0;
50
- };
51
- const getSelected = ({ props, cell, format, t, cellDate, selectedDate }) => {
39
+ const getSelected = (props, cell, format, t, cellDate, selectedDate) => {
52
40
  let selected = cell.selected;
53
41
  if (props.selectionMode === "dates") {
54
42
  selected = arrayFind(selectedDate, (date) => formatDate(date, format, t) === formatDate(cellDate, format, t));
@@ -61,14 +49,7 @@ const getCell = ({ state, props }) => (row, i, j) => {
61
49
  const now = getDateTimestamp(/* @__PURE__ */ new Date());
62
50
  let cell = row[props.showWeekNumber ? j + 1 : j];
63
51
  if (!cell) {
64
- cell = {
65
- row: i,
66
- column: j,
67
- inRange: false,
68
- start: false,
69
- end: false,
70
- type: DATEPICKER.Normal
71
- };
52
+ cell = { row: i, column: j, inRange: false, start: false, end: false, type: DATEPICKER.Normal };
72
53
  }
73
54
  cell.type = DATEPICKER.Normal;
74
55
  const index = i * 7 + j;
@@ -81,15 +62,7 @@ const getCell = ({ state, props }) => (row, i, j) => {
81
62
  };
82
63
  const doCount = ({ i, day, offset, j, cell, count, dateCountOfLastMonth, dateCountOfMonth }) => {
83
64
  if (i >= 0 && i <= 1) {
84
- const ret = formatJudg({
85
- day,
86
- offset,
87
- j,
88
- i,
89
- cell,
90
- count,
91
- dateCountOfLastMonth
92
- });
65
+ const ret = formatJudg({ day, offset, j, i, cell, count, dateCountOfLastMonth });
93
66
  count = ret.count;
94
67
  } else {
95
68
  if (count <= dateCountOfMonth) {
@@ -101,7 +74,6 @@ const doCount = ({ i, day, offset, j, cell, count, dateCountOfLastMonth, dateCou
101
74
  }
102
75
  return count;
103
76
  };
104
- const coerceTruthyValueToArray = (val) => Array.isArray(val) ? val : val ? [val] : [];
105
77
  const getRows = ({ api, props, state, t, vm }) => () => {
106
78
  const date = new Date(state.year, state.month, 1);
107
79
  let day = getFirstDayOfMonth(date);
@@ -133,15 +105,7 @@ const getRows = ({ api, props, state, t, vm }) => () => {
133
105
  const { cell, cellDate } = api.getCell(row, i, j, DATEPICKER.Normal, props);
134
106
  count = doCount({ i, day, offset, j, cell, count, dateCountOfLastMonth, dateCountOfMonth });
135
107
  cell.disabled = typeof disabledDate === "function" && disabledDate(cellDate);
136
- cell.selected = getSelected({
137
- props,
138
- cell,
139
- api,
140
- format: DATEPICKER.DateFormats.date,
141
- t,
142
- cellDate,
143
- selectedDate
144
- });
108
+ cell.selected = getSelected(props, cell, DATEPICKER.DateFormats.date, t, cellDate, selectedDate);
145
109
  cell.customClass = typeof cellClassName === "function" && cellClassName(cellDate);
146
110
  vm.$set(row, props.showWeekNumber ? j + 1 : j, cell);
147
111
  arr[i].push(cellDate);
@@ -165,6 +129,19 @@ const getRows = ({ api, props, state, t, vm }) => () => {
165
129
  }
166
130
  return rows;
167
131
  };
132
+ const arrayFindIndex = (arr, pred) => {
133
+ for (let i = 0, len = arr.length; i !== len; ++i) {
134
+ if (pred(arr[i])) {
135
+ return i;
136
+ }
137
+ }
138
+ return -1;
139
+ };
140
+ const arrayFind = (arr, pred) => {
141
+ const idx = arrayFindIndex(arr, pred);
142
+ return ~idx ? arr[idx] : void 0;
143
+ };
144
+ const coerceTruthyValueToArray = (val) => Array.isArray(val) ? val : val ? [val] : [];
168
145
  const watchMinDate = ({ api, props }) => (value, oldvalue) => {
169
146
  if (getDateTimestamp(value) !== getDateTimestamp(oldvalue)) {
170
147
  api.markRange(props.minDate, props.maxDate);
@@ -259,14 +236,14 @@ const markRange = ({ props, state }) => (minDate, maxDate) => {
259
236
  for (let i = 0, k = rows.length; i < k; i++) {
260
237
  const row = rows[i];
261
238
  for (let j = 0, l = row.length; j < l; j++) {
262
- if (!props.showWeekNumber || j !== 0) {
263
- const cell = row[j];
264
- const index = i * 7 + j + (props.showWeekNumber ? -1 : 0);
265
- const time = nextDate(startDate, index - state.offsetDay).getTime();
266
- cell.inRange = minDate && time >= minDate && time <= maxDate;
267
- cell.start = minDate && time === minDate;
268
- cell.end = maxDate && time === maxDate;
269
- }
239
+ if (props.showWeekNumber && j === 0)
240
+ continue;
241
+ const cell = row[j];
242
+ const index = i * 7 + j + (props.showWeekNumber ? -1 : 0);
243
+ const time = nextDate(startDate, index - state.offsetDay).getTime();
244
+ cell.inRange = minDate && time >= minDate && time <= maxDate;
245
+ cell.start = minDate && time === minDate;
246
+ cell.end = maxDate && time === maxDate;
270
247
  }
271
248
  }
272
249
  };
@@ -312,10 +289,6 @@ const getTarget = (event) => {
312
289
  }
313
290
  return target;
314
291
  };
315
- const removeFromArray = (arr, pred) => {
316
- const idx = typeof pred === "function" ? arrayFindIndex(arr, pred) : arr.indexOf(pred);
317
- return idx >= 0 ? [...arr.slice(0, idx), ...arr.slice(idx + 1)] : arr;
318
- };
319
292
  const handleClick = ({ api, emit, props, state }) => (event) => {
320
293
  let target = getTarget(event);
321
294
  if (target.tagName !== "TD") {
@@ -357,6 +330,10 @@ const handleClick = ({ api, emit, props, state }) => (event) => {
357
330
  emit("pick", newValue);
358
331
  }
359
332
  };
333
+ const removeFromArray = (arr, pred) => {
334
+ const idx = typeof pred === "function" ? arrayFindIndex(arr, pred) : arr.indexOf(pred);
335
+ return idx >= 0 ? [...arr.slice(0, idx), ...arr.slice(idx + 1)] : arr;
336
+ };
360
337
  const getCssToken = ({ api }) => (cell, prexfix = "") => {
361
338
  const cssStr = api.getCellClasses(cell) || "";
362
339
  return cssStr.split(" ").map((className) => prexfix + className);
package/date-table/vue.js CHANGED
@@ -29,7 +29,7 @@ const initState = ({ reactive, computed, api: api2, props }) => {
29
29
  month: computed(() => !Array.isArray(props.date) && props.date.getMonth()),
30
30
  offsetDay: computed(() => api2.getOffsetDay()),
31
31
  year: computed(() => !Array.isArray(props.date) && props.date.getFullYear()),
32
- startDate: computed(() => getStartDateOfMonth(state.year, state.month)),
32
+ startDate: computed(() => getStartDateOfMonth(state.year, state.month, state.offsetDay)),
33
33
  date: props.value
34
34
  });
35
35
  return state;
package/dept/index.js CHANGED
@@ -93,6 +93,7 @@ const getDeptList = ({ api, state, deptState }) => ({ level, value, auto }) => {
93
93
  const selectChange = ({ emit, api, state, deptState }) => ({ level, value }) => {
94
94
  api.resetDeptState(deptState.slice(level + 1, 9));
95
95
  api.setSelectData();
96
+ state.selectChanged = true;
96
97
  const current = formatJudgCofim(deptState);
97
98
  const { hrapprover } = state;
98
99
  if (hrapprover) {
@@ -145,7 +146,13 @@ const confirm = ({ api, props, state }) => () => {
145
146
  }
146
147
  }
147
148
  };
148
- const closeDialog = (emit) => () => emit("close");
149
+ const closeDialog = ({ emit, state, deptState }) => (type) => {
150
+ if (state.selectChanged) {
151
+ state.labels = state.lastLabels;
152
+ deptState.forEach((item, i) => Object.assign(item, state.lastDeptState[i]));
153
+ }
154
+ emit("close", type);
155
+ };
149
156
  const cancel = ({ emit, state, deptState }) => () => {
150
157
  state.labels = state.lastLabels;
151
158
  deptState.forEach((item, i) => Object.assign(item, state.lastDeptState[i]));
package/dept/vue.js CHANGED
@@ -38,6 +38,7 @@ const initState = ({ reactive, computed, parent, props, inject, lastDeptState })
38
38
  display: "",
39
39
  open: false,
40
40
  loading: false,
41
+ selectChanged: false,
41
42
  searchValue: "",
42
43
  searchOptions: [],
43
44
  current: "",
@@ -52,7 +53,7 @@ const initApi = ({ api: api2, state, deptState, emit, $service, props }) => {
52
53
  Object.assign(api2, {
53
54
  state,
54
55
  deptState,
55
- closeDialog: closeDialog(emit),
56
+ closeDialog: closeDialog({ emit, state, deptState }),
56
57
  resetDeptState: resetDeptState(deptState),
57
58
  fetchDept: $service.fetchDept,
58
59
  fetchDeptList: $service.fetchDeptList,
@@ -82,6 +83,14 @@ const renderless = (props, { onBeforeUnmount, reactive, watch, inject, computed
82
83
  const state = initState({ reactive, computed, parent, props, inject, lastDeptState });
83
84
  initApi({ api: api2, state, deptState, emit, $service, props });
84
85
  watch(() => props.modelValue, api2.getDisplay, { immediate: true });
86
+ watch(
87
+ () => state.open,
88
+ (val) => {
89
+ if (!val) {
90
+ state.selectChanged = false;
91
+ }
92
+ }
93
+ );
85
94
  onBeforeUnmount(() => {
86
95
  state.open = false;
87
96
  });