@opentiny/vue-renderless 3.12.1 → 3.13.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 (60) hide show
  1. package/alert/index.js +50 -1
  2. package/alert/vue.js +36 -9
  3. package/calendar-bar/index.js +2 -2
  4. package/calendar-view/index.js +5 -11
  5. package/calendar-view/vue.js +1 -1
  6. package/cascader/index.js +3 -2
  7. package/cascader-mobile/index.js +1 -1
  8. package/cascader-mobile/vue.js +1 -1
  9. package/cascader-view/index.js +1 -1
  10. package/checkbox/vue.js +1 -0
  11. package/checkbox-group/vue.js +1 -0
  12. package/col/vue.js +3 -2
  13. package/common/date.js +2 -0
  14. package/common/deps/popper.js +42 -3
  15. package/common/index.js +1 -1
  16. package/common/runtime.js +1 -1
  17. package/container/index.js +17 -1
  18. package/container/vue.js +12 -3
  19. package/dropdown-item/vue.js +1 -1
  20. package/grid/utils/common.js +10 -5
  21. package/input/index.js +8 -2
  22. package/input/vue.js +13 -8
  23. package/label/index.js +56 -0
  24. package/label/vue.js +26 -0
  25. package/mask/index.js +13 -0
  26. package/mask/vue.js +18 -0
  27. package/numeric/index.js +13 -3
  28. package/numeric/vue.js +6 -1
  29. package/option/index.js +1 -2
  30. package/option/vue.js +7 -1
  31. package/package.json +1 -1
  32. package/pager/index.js +358 -0
  33. package/pager/vue.js +114 -2
  34. package/picker/index.js +1 -1
  35. package/pop-upload/index.js +0 -2
  36. package/pop-upload/vue.js +0 -4
  37. package/pull-refresh/index.js +55 -63
  38. package/pull-refresh/vue.js +20 -7
  39. package/select/index.js +11 -3
  40. package/select/vue.js +5 -4
  41. package/slider/index.js +27 -3
  42. package/slider/vue.js +26 -6
  43. package/tag/vue.js +5 -1
  44. package/tall-storage/index.js +4 -5
  45. package/types/action-menu.type.d.ts +5 -0
  46. package/types/alert.type.d.ts +16 -1
  47. package/types/button.type.d.ts +1 -0
  48. package/types/checkbox.type.d.ts +3 -0
  49. package/types/date-picker.type.d.ts +1 -1
  50. package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8ea6c633.d.ts} +1 -1
  51. package/types/dropdown-item.type.d.ts +1 -1
  52. package/types/dropdown-menu.type.d.ts +1 -1
  53. package/types/dropdown.type.d.ts +1 -0
  54. package/types/input.type.d.ts +21 -3
  55. package/types/label.type.d.ts +81 -0
  56. package/types/numeric.type.d.ts +1 -1
  57. package/types/pager.type.d.ts +159 -1
  58. package/types/slider.type.d.ts +8 -0
  59. package/types/tab-item.type.d.ts +0 -1
  60. package/types/tag.type.d.ts +12 -0
package/label/index.js ADDED
@@ -0,0 +1,56 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const prefix = "tiny-mobile-label-";
3
+ function numFormat(num, decimal) {
4
+ let str = "";
5
+ str = (Math.round(num * 100) / 100).toFixed(decimal).toString().replace(/(\d)(?=(\d{3})+\.)/g, function($0, $1) {
6
+ return $1 + ",";
7
+ });
8
+ return str;
9
+ }
10
+ function handleNumberLabel(label, decimal) {
11
+ let val = label;
12
+ const reg1 = /[^(\-|\+)?\d+(\.\d+)?$]/g;
13
+ const reg2 = /0*([1-9]\d*|0\.\d+)/;
14
+ val = val.replace(reg1, "").replace(reg2, "$1");
15
+ let arr = val.split(".");
16
+ let numStr = "";
17
+ for (let i = 0; i < arr.length; i++) {
18
+ if (i === arr.length - 1 && arr.length > 1) {
19
+ numStr += ".";
20
+ }
21
+ numStr += arr[i];
22
+ }
23
+ numStr = numFormat(numStr, decimal);
24
+ numStr = numStr.replace(/\d+/, (s) => {
25
+ return s.replace(/(\d)(?=(\d{3})+$)/g, "$1,");
26
+ });
27
+ return numStr;
28
+ }
29
+ const handleClick = ({ emit, state }) => () => {
30
+ emit("click", state.label);
31
+ };
32
+ const computeLabel = (props) => () => {
33
+ let label = props.label;
34
+ if (props.type === "number") {
35
+ label = handleNumberLabel(props.label, props.decimal);
36
+ }
37
+ if (props.limit !== 0 && label.length > props.limit) {
38
+ return label.slice(0, props.limit);
39
+ }
40
+ return label;
41
+ };
42
+ const computeLabelClass = (props) => () => {
43
+ return [
44
+ `${prefix}${props.size}`,
45
+ `${prefix}${props.color}`,
46
+ `${prefix}${props.position}`,
47
+ props.wholeline || props.ellipsis === 1 || props.ellipsis === 2 || props.ellipsis === 3 ? `${prefix}wholeline` : "",
48
+ props.ellipsis > 0 && props.ellipsis < 4 ? `${prefix}ellipsis${props.ellipsis}` : "",
49
+ props.bold ? `${prefix}bold` : ""
50
+ ];
51
+ };
52
+ export {
53
+ computeLabel,
54
+ computeLabelClass,
55
+ handleClick
56
+ };
package/label/vue.js ADDED
@@ -0,0 +1,26 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { handleClick, computeLabel, computeLabelClass } from "./index";
3
+ const api = ["state", "handleClick", "computeLabel", "computeLabelStyle", "computeLabelClass"];
4
+ const renderless = (props, { computed, onBeforeUnmount, reactive, watch, inject }, { emit, parent }) => {
5
+ parent.tinyForm = parent.tinyForm || inject("form", null);
6
+ const state = reactive({
7
+ label: computed(() => api2.computeLabel()),
8
+ type: props.type,
9
+ color: props.color,
10
+ size: props.size,
11
+ labelClass: computed(() => api2.computeLabelClass()),
12
+ isRequired: props.isRequired
13
+ });
14
+ const api2 = {
15
+ state,
16
+ handleClick: handleClick({ emit, state }),
17
+ computeLabel: computeLabel(props),
18
+ // computeLabelStyle: computeLabelStyle(props, state),
19
+ computeLabelClass: computeLabelClass(props)
20
+ };
21
+ return api2;
22
+ };
23
+ export {
24
+ api,
25
+ renderless
26
+ };
package/mask/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const handleTouch = ({ props, emit }) => (event) => {
3
+ if (props.cancelTouch) {
4
+ event.preventDefault();
5
+ event.stopPropagation();
6
+ } else {
7
+ emit("update:visible", false);
8
+ }
9
+ emit("click", props.visible);
10
+ };
11
+ export {
12
+ handleTouch
13
+ };
package/mask/vue.js ADDED
@@ -0,0 +1,18 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { handleTouch } from "./index";
3
+ const api = ["state", "handleTouch"];
4
+ const renderless = (props, { reactive, computed }, { emit }) => {
5
+ const api2 = {};
6
+ const state = reactive({
7
+ calcStyle: computed(() => ({ zIndex: props.zIndex }))
8
+ });
9
+ Object.assign(api2, {
10
+ state,
11
+ handleTouch: handleTouch({ props, emit })
12
+ });
13
+ return api2;
14
+ };
15
+ export {
16
+ api,
17
+ renderless
18
+ };
package/numeric/index.js CHANGED
@@ -219,9 +219,19 @@ const handleInput = ({ state, api, emit, props }) => (event) => {
219
219
  state.lastInput = value;
220
220
  state.userInput = value;
221
221
  };
222
- const handleInputChange = ({ api }) => (event) => {
223
- const value = event.target.value;
224
- api.setCurrentValue(value === "-" ? 0 : value);
222
+ const handleInputChange = ({ api, state, props }) => (event) => {
223
+ var _a, _b;
224
+ const value = ((_a = event.target) == null ? void 0 : _a.value) === "-" ? 0 : (_b = event.target) == null ? void 0 : _b.value;
225
+ if (props.stepStrictly) {
226
+ const previousValue = Number((props.mouseWheel ? state.displayValue : props.modelValue) || 0);
227
+ if (Math.abs(previousValue - value) % Number(props.step) === 0)
228
+ return api.setCurrentValue(value);
229
+ const step = Number(props.step);
230
+ const difference = value - previousValue;
231
+ const sign = difference >= 0 ? 1 : -1;
232
+ return api.setCurrentValue(sign * Math.round(Math.abs(difference) / step) * step + previousValue);
233
+ }
234
+ api.setCurrentValue(value);
225
235
  };
226
236
  const select = (refs) => () => refs.input.select();
227
237
  const mounted = ({ constants, parent, props, state }) => () => {
package/numeric/vue.js CHANGED
@@ -91,7 +91,7 @@ const initApi = ({
91
91
  displayValue: displayValue({ props, state }),
92
92
  internalDecrease: internalDecrease({ api: api2, state }),
93
93
  internalIncrease: internalIncrease({ api: api2, state }),
94
- handleInputChange: handleInputChange({ api: api2 }),
94
+ handleInputChange: handleInputChange({ api: api2, state, props }),
95
95
  mouseEvent: mouseEvent({ api: api2, props, state }),
96
96
  handleBlur: handleBlur({ constants, dispatch, emit, props, state, api: api2 }),
97
97
  watchValue: watchValue({ api: api2, state, nextTick }),
@@ -108,6 +108,11 @@ const initWatch = ({
108
108
  props,
109
109
  api: api2
110
110
  }) => {
111
+ watch(() => [props.max, props.min], ([curMax, curMin]) => {
112
+ if (curMax < curMin) {
113
+ throw new Error("[Numeric]: The maximum value should not be less than to the minimum value");
114
+ }
115
+ }, { immediate: true });
111
116
  watch(() => props.modelValue, api2.watchValue, { immediate: true });
112
117
  watch(() => state.isDisplayOnly, api2.dispatchDisplayedValue);
113
118
  };
package/option/index.js CHANGED
@@ -32,9 +32,8 @@ const selectOptionClick = ({ props, state, select, constants, vm }) => () => {
32
32
  select.state.selectEmitter.emit(constants.EVENT_NAME.handleOptionClick, vm, true);
33
33
  }
34
34
  };
35
- const queryChange = ({ select, props, state }) => (query) => {
35
+ const queryChange = ({ props, state }) => (query) => {
36
36
  state.visible = new RegExp(escapeRegexpString(query), "i").test(state.currentLabel) || props.created;
37
- select.state.filteredOptionsCount += state.visible ? 1 : -1;
38
37
  };
39
38
  const toggleEvent = ({ props, vm, type }) => {
40
39
  const optionEl = vm.$refs.option;
package/option/vue.js CHANGED
@@ -49,7 +49,7 @@ const initApi = ({ api: api2, props, state, select, constants, vm }) => {
49
49
  isEqual: isEqual({ select, state }),
50
50
  contains: contains({ select, state }),
51
51
  hoverItem: hoverItem({ select, vm, props, state }),
52
- queryChange: queryChange({ select, props, state }),
52
+ queryChange: queryChange({ props, state }),
53
53
  selectOptionClick: selectOptionClick({ constants, vm, props, state, select }),
54
54
  handleGroupDisabled: handleGroupDisabled(state),
55
55
  initValue: initValue({ select, props, constants, vm })
@@ -76,6 +76,12 @@ const initWatch = ({ watch, props, state, select, constants }) => {
76
76
  }
77
77
  }
78
78
  );
79
+ watch(
80
+ () => state.visible,
81
+ () => {
82
+ select.state.filteredOptionsCount += state.visible ? 1 : -1;
83
+ }
84
+ );
79
85
  };
80
86
  const initOnMounted = ({ onMounted, props, api: api2, vm, state, constants, select }) => {
81
87
  onMounted(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/vue-renderless",
3
- "version": "3.12.1",
3
+ "version": "3.13.1",
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/index.js ADDED
@@ -0,0 +1,358 @@
1
+ import {
2
+ __spreadValues
3
+ } from "../chunk-G2ADBYYC.js";
4
+ import { emitEvent } from "../common/event";
5
+ const computedShowPager = ({ props, state }) => () => {
6
+ const hidePager = props.hideOnSinglePage && (!state.internalPageCount || state.internalPageCount === 1);
7
+ return state.internalLayout.length > 0 && !hidePager;
8
+ };
9
+ const computedInternalLayout = ({ props }) => () => {
10
+ let layout = "";
11
+ if (props.mode && !props.layout) {
12
+ props.mode === "number" && (layout = "total, sizes, prev, pager, next, jumper");
13
+ props.mode === "simple" && (layout = "sizes, total, prev, current, next");
14
+ props.mode === "complete" && (layout = "sizes, total, prev, pager, next, jumper");
15
+ props.mode === "fixed" && (layout = "prev,pager,next");
16
+ } else if (!props.mode && props.layout || props.mode && props.layout) {
17
+ layout = props.layout;
18
+ } else {
19
+ layout = "total, prev, pager, next, jumper";
20
+ }
21
+ if (!layout) {
22
+ return [];
23
+ } else {
24
+ const components = layout.split(",").map((item) => item.trim());
25
+ return components;
26
+ }
27
+ };
28
+ const computedTotalText = ({ props, t }) => () => {
29
+ if (typeof props.customTotal === "string")
30
+ return props.customTotal;
31
+ const totals = Number(props.total);
32
+ if (isNaN(totals))
33
+ return "0";
34
+ const HUNDRED_THOUSAND = 1e5;
35
+ const MILLION = 1e6;
36
+ const TEN_MILLION = 1e7;
37
+ if (totals <= HUNDRED_THOUSAND) {
38
+ return String(totals);
39
+ } else if (totals <= MILLION) {
40
+ return t("ui.page.hundredThousand");
41
+ } else if (totals <= TEN_MILLION) {
42
+ return t("ui.page.million");
43
+ } else {
44
+ return t("ui.page.tenMillion");
45
+ }
46
+ };
47
+ const computedInternalPageCount = ({ props, state }) => () => {
48
+ if (typeof props.total === "number") {
49
+ return Math.max(1, Math.ceil(props.total / state.internalPageSize));
50
+ } else if (typeof props.pageCount === "number") {
51
+ return Math.max(1, props.pageCount);
52
+ }
53
+ return null;
54
+ };
55
+ const handleJumperFocus = ({ state }) => (e) => {
56
+ var _a;
57
+ state.jumperBackup = (_a = e.target) == null ? void 0 : _a.value;
58
+ };
59
+ const watchInternalCurrentPage = ({ state, emit }) => (currentPage) => {
60
+ const value = String(currentPage);
61
+ if (state.jumperValue !== value) {
62
+ state.jumperValue = value;
63
+ }
64
+ emit("update:currentPage", currentPage);
65
+ emit("current-change", currentPage);
66
+ state.lastEmittedPage = -1;
67
+ };
68
+ const watchPageSizes = ({ state, props }) => (newVal) => {
69
+ if (Array.isArray(newVal)) {
70
+ state.internalPageSize = newVal.includes(props.pageSize) ? props.pageSize : newVal[0];
71
+ }
72
+ };
73
+ const watchCurrentPage = ({ state, api }) => (curPage) => {
74
+ state.internalCurrentPage = api.getValidCurrentPage(curPage);
75
+ };
76
+ const watchInternalPageCount = ({ state, api }) => (pageCount) => {
77
+ const oldCurPage = state.internalCurrentPage;
78
+ if (pageCount && pageCount > 0 && oldCurPage === 0) {
79
+ state.internalCurrentPage = 1;
80
+ } else if (oldCurPage > Number(pageCount)) {
81
+ state.internalCurrentPage = pageCount || 1;
82
+ state.userChangePageSize && api.emitChange();
83
+ }
84
+ state.userChangePageSize = false;
85
+ };
86
+ const watchPageSize = ({ state }) => (pageSize) => {
87
+ state.internalPageSize = isNaN(pageSize) ? 10 : pageSize;
88
+ };
89
+ const watchTotal = ({ state }) => (total) => {
90
+ state.internalTotal = total;
91
+ };
92
+ const handleSizeChange = ({ props, state, api, emit, vm }) => (val) => {
93
+ val = Number(val);
94
+ if (val !== state.internalPageSize) {
95
+ const callback = () => {
96
+ if (!api.beforeChangeHandler()) {
97
+ return;
98
+ }
99
+ state.internalPageSize = val;
100
+ state.userChangePageSize = true;
101
+ state.showSizes = false;
102
+ emit("update:pageSize", val);
103
+ emit("size-change", val);
104
+ emit("page-change", {
105
+ currentPage: state.internalCurrentPage,
106
+ pageSize: val,
107
+ total: state.internalTotal
108
+ });
109
+ vm.$refs.sizesList[0].state.showPopper = false;
110
+ };
111
+ if (props.isBeforePageChange) {
112
+ let newPageSize = val;
113
+ let currentPageSize = state.internalPageSize;
114
+ let params = { newPageSize, currentPageSize, callback };
115
+ api.beforeSizeChangeHandler(params);
116
+ } else {
117
+ callback();
118
+ }
119
+ }
120
+ };
121
+ const handleJumperInput = ({ state }) => (e) => {
122
+ const target = e.target;
123
+ if (!target.value) {
124
+ state.jumperValue = "";
125
+ } else if (/^\d+$/.test(target.value)) {
126
+ state.jumperValue = target.value || "1";
127
+ }
128
+ target.value = state.jumperValue;
129
+ };
130
+ const handleJumperChange = ({ props, state, api }) => () => {
131
+ api.parseValueNumber();
132
+ const callback = () => {
133
+ api.handleJumperClick();
134
+ };
135
+ const rollback = () => {
136
+ state.jumperValue = String(state.jumperBackup);
137
+ };
138
+ const newPage = state.jumperValue;
139
+ const currentPage = state.jumperBackup;
140
+ if (props.isBeforePageChange && newPage !== currentPage) {
141
+ const params = { newPage, currentPage, callback, rollback };
142
+ api.beforePagerChangeHandler(params);
143
+ } else {
144
+ callback();
145
+ }
146
+ };
147
+ const handleJumperClick = ({ props, state, api }) => () => {
148
+ if (!api.canJumperGo() || props.disabled)
149
+ return;
150
+ state.internalCurrentPage = api.getValidCurrentPage(state.jumperValue);
151
+ api.emitChange();
152
+ };
153
+ const isValueNumber = ({ state }) => () => {
154
+ return !isNaN(Number(state.jumperValue));
155
+ };
156
+ const parseValueNumber = ({ state }) => () => {
157
+ let value = Number(
158
+ String(state.jumperValue).split(/[^0-9-+.]/).join("")
159
+ );
160
+ if (isNaN(value)) {
161
+ value = 1;
162
+ }
163
+ value = Number(value.toFixed(0));
164
+ const min = 1;
165
+ const max = state.internalPageCount || 1;
166
+ if (value >= max) {
167
+ state.jumperValue = String(max);
168
+ } else if (value <= min) {
169
+ state.jumperValue = String(min);
170
+ } else {
171
+ state.jumperValue = String(value);
172
+ }
173
+ };
174
+ const handleSizeShowPopover = ({ state, props }) => () => {
175
+ if (props.disabled) {
176
+ state.showSizes = false;
177
+ return;
178
+ }
179
+ state.showSizes = true;
180
+ };
181
+ const handleSizeHidePopover = ({ state }) => () => {
182
+ state.showSizes = false;
183
+ };
184
+ const canJumperGo = ({ props, state, vm }) => () => {
185
+ const inputValue = Number(vm.$refs.jumperInput[0].value || 0);
186
+ const currentPage = Number(state.internalCurrentPage || 0);
187
+ return props.accurateJumper ? inputValue !== currentPage : true;
188
+ };
189
+ const beforeSizeChangeHandler = ({ state, emit }) => (params) => {
190
+ const { newPageSize, currentPageSize, callback } = params;
191
+ const newPage = 1;
192
+ const currentPage = state.internalCurrentPage;
193
+ const temp = {
194
+ newPage,
195
+ newPageSize,
196
+ currentPage,
197
+ currentPageSize,
198
+ callback
199
+ };
200
+ emit("before-page-change", temp);
201
+ };
202
+ const beforePagerChangeHandler = ({ state, emit }) => (params) => {
203
+ const { newPage, currentPage, callback, rollback } = params;
204
+ const newPageSize = state.internalPageSize;
205
+ const currentPageSize = state.internalPageSize;
206
+ const temp = {
207
+ newPage,
208
+ newPageSize,
209
+ currentPage,
210
+ currentPageSize,
211
+ callback,
212
+ rollback
213
+ };
214
+ emit("before-page-change", temp);
215
+ };
216
+ const beforeJumperChangeHandler = ({ state, emit }) => (params) => {
217
+ const { newPage, currentPage, callback, rollback } = params;
218
+ const newPageSize = state.internalPageSize;
219
+ const currentPageSize = state.internalPageSize;
220
+ const temp = {
221
+ newPage,
222
+ newPageSize,
223
+ currentPage,
224
+ currentPageSize,
225
+ callback,
226
+ rollback
227
+ };
228
+ emit("before-page-change", temp);
229
+ };
230
+ const copyEmit = ({ emit }) => (...args) => {
231
+ emit(args[0], ...args.slice(1));
232
+ };
233
+ const beforeChangeHandler = ({ state, api }) => (val = -1) => {
234
+ return emitEvent(api.copyEmit, "before-change", state.internalCurrentPage, void 0, val);
235
+ };
236
+ const handleCurrentChange = ({ state, api }) => (val) => {
237
+ if (!api.beforeChangeHandler(val)) {
238
+ return;
239
+ }
240
+ state.internalCurrentPage = api.getValidCurrentPage(val);
241
+ state.userChangePageSize = true;
242
+ api.emitChange();
243
+ };
244
+ const prev = ({ state, props, api, emit }) => () => {
245
+ const callback = () => {
246
+ if (props.disabled || !api.beforeChangeHandler(state.internalCurrentPage - 1)) {
247
+ return;
248
+ }
249
+ const newVal = state.internalCurrentPage - 1;
250
+ state.internalCurrentPage = api.getValidCurrentPage(newVal);
251
+ emit("prev-click", state.internalCurrentPage);
252
+ api.emitChange();
253
+ };
254
+ if (props.isBeforePageChange) {
255
+ const newPage = state.internalCurrentPage - 1;
256
+ const temp = api.buildBeforePageChangeParam({ newPage, callback });
257
+ emit("before-page-change", temp);
258
+ } else {
259
+ callback();
260
+ }
261
+ };
262
+ const next = ({ props, state, api, emit }) => () => {
263
+ const callback = () => {
264
+ if (props.disabled || !api.beforeChangeHandler(state.internalCurrentPage + 1)) {
265
+ return;
266
+ }
267
+ const newVal = state.internalCurrentPage + 1;
268
+ state.internalCurrentPage = api.getValidCurrentPage(newVal);
269
+ emit("next-click", state.internalCurrentPage);
270
+ api.emitChange();
271
+ };
272
+ if (props.isBeforePageChange) {
273
+ const newPage = state.internalCurrentPage + 1;
274
+ const temp = api.buildBeforePageChangeParam({ newPage, callback });
275
+ emit("before-page-change", temp);
276
+ } else {
277
+ callback();
278
+ }
279
+ };
280
+ const buildBeforePageChangeParam = ({ state }) => (param) => {
281
+ const currentPage = state.internalCurrentPage;
282
+ const newPageSize = state.internalPageSize;
283
+ const currentPageSize = state.internalPageSize;
284
+ return __spreadValues({ currentPage, newPageSize, currentPageSize }, param);
285
+ };
286
+ const getValidCurrentPage = ({ state }) => (val) => {
287
+ const parseVal = Number(val);
288
+ const hasPageCount = typeof state.internalPageCount === "number";
289
+ let resetVal;
290
+ if (hasPageCount) {
291
+ if (parseVal < 1) {
292
+ resetVal = 1;
293
+ } else if (parseVal > (state.internalPageCount || 0)) {
294
+ resetVal = state.internalPageCount;
295
+ }
296
+ } else {
297
+ if (isNaN(parseVal) || parseVal < 1) {
298
+ resetVal = 1;
299
+ }
300
+ }
301
+ if (resetVal === void 0 && isNaN(parseVal)) {
302
+ resetVal = 1;
303
+ } else if (resetVal === 0) {
304
+ resetVal = 1;
305
+ }
306
+ return resetVal === void 0 ? parseVal : resetVal;
307
+ };
308
+ const emitChange = ({ state, nextTick, emit }) => () => {
309
+ nextTick(() => {
310
+ if (state.internalCurrentPage !== state.lastEmittedPage || state.userChangePageSize) {
311
+ emit("update:current-page", state.internalCurrentPage);
312
+ emit("page-change", {
313
+ currentPage: state.internalCurrentPage,
314
+ pageSize: state.internalPageSize,
315
+ total: state.internalTotal
316
+ });
317
+ state.lastEmittedPage = state.internalCurrentPage;
318
+ state.userChangePageSize = false;
319
+ }
320
+ });
321
+ };
322
+ const setTotal = ({ state }) => (val) => {
323
+ state.internalTotal = val;
324
+ };
325
+ export {
326
+ beforeChangeHandler,
327
+ beforeJumperChangeHandler,
328
+ beforePagerChangeHandler,
329
+ beforeSizeChangeHandler,
330
+ buildBeforePageChangeParam,
331
+ canJumperGo,
332
+ computedInternalLayout,
333
+ computedInternalPageCount,
334
+ computedShowPager,
335
+ computedTotalText,
336
+ copyEmit,
337
+ emitChange,
338
+ getValidCurrentPage,
339
+ handleCurrentChange,
340
+ handleJumperChange,
341
+ handleJumperClick,
342
+ handleJumperFocus,
343
+ handleJumperInput,
344
+ handleSizeChange,
345
+ handleSizeHidePopover,
346
+ handleSizeShowPopover,
347
+ isValueNumber,
348
+ next,
349
+ parseValueNumber,
350
+ prev,
351
+ setTotal,
352
+ watchCurrentPage,
353
+ watchInternalCurrentPage,
354
+ watchInternalPageCount,
355
+ watchPageSize,
356
+ watchPageSizes,
357
+ watchTotal
358
+ };
package/pager/vue.js CHANGED
@@ -1,7 +1,119 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- const api = [];
3
- const renderless = () => {
2
+ import {
3
+ computedShowPager,
4
+ computedInternalLayout,
5
+ computedTotalText,
6
+ computedInternalPageCount,
7
+ handleJumperFocus,
8
+ handleSizeChange,
9
+ handleJumperInput,
10
+ handleJumperChange,
11
+ handleJumperClick,
12
+ isValueNumber,
13
+ parseValueNumber,
14
+ handleSizeShowPopover,
15
+ handleSizeHidePopover,
16
+ canJumperGo,
17
+ beforeSizeChangeHandler,
18
+ beforePagerChangeHandler,
19
+ copyEmit,
20
+ beforeChangeHandler,
21
+ handleCurrentChange,
22
+ prev,
23
+ next,
24
+ buildBeforePageChangeParam,
25
+ getValidCurrentPage,
26
+ emitChange,
27
+ setTotal,
28
+ watchInternalCurrentPage,
29
+ watchPageSizes,
30
+ watchCurrentPage,
31
+ watchInternalPageCount,
32
+ watchPageSize,
33
+ watchTotal
34
+ } from "./index";
35
+ const api = [
36
+ "state",
37
+ "handleJumperFocus",
38
+ "handleSizeChange",
39
+ "handleJumperInput",
40
+ "handleJumperChange",
41
+ "handleJumperClick",
42
+ "isValueNumber",
43
+ "parseValueNumber",
44
+ "handleSizeShowPopover",
45
+ "handleSizeHidePopover",
46
+ "canJumperGo",
47
+ "beforeSizeChangeHandler",
48
+ "beforePagerChangeHandler",
49
+ "beforeJumperChangeHandler",
50
+ "beforeChangeHandler",
51
+ "handleCurrentChange",
52
+ "prev",
53
+ "next",
54
+ "buildBeforePageChangeParam",
55
+ "getValidCurrentPage",
56
+ "emitChange",
57
+ "setTotal"
58
+ ];
59
+ const renderless = (props, { reactive, computed, watch }, { emit, vm, nextTick, t }) => {
4
60
  const api2 = {};
61
+ const state = reactive({
62
+ showSizes: false,
63
+ internalCurrentPage: 1,
64
+ internalPageSize: props.pageSize,
65
+ lastEmittedPage: -1,
66
+ userChangePageSize: false,
67
+ internalTotal: props.total,
68
+ jumperValue: "1",
69
+ jumperBackup: "1",
70
+ showPager: computed(() => api2.computedShowPager()),
71
+ internalLayout: computed(() => api2.computedInternalLayout()),
72
+ totalText: computed(() => api2.computedTotalText()),
73
+ internalPageCount: computed(() => api2.computedInternalPageCount())
74
+ });
75
+ Object.assign(api2, {
76
+ state,
77
+ computedShowPager: computedShowPager({ props, state }),
78
+ computedInternalLayout: computedInternalLayout({ props }),
79
+ computedTotalText: computedTotalText({ props, t }),
80
+ computedInternalPageCount: computedInternalPageCount({ props, state }),
81
+ getValidCurrentPage: getValidCurrentPage({ state }),
82
+ handleJumperFocus: handleJumperFocus({ state }),
83
+ handleSizeChange: handleSizeChange({ props, state, api: api2, emit, vm }),
84
+ handleJumperInput: handleJumperInput({ state }),
85
+ handleJumperChange: handleJumperChange({ props, state, api: api2 }),
86
+ handleJumperClick: handleJumperClick({ props, state, api: api2 }),
87
+ isValueNumber: isValueNumber({ state }),
88
+ parseValueNumber: parseValueNumber({ state }),
89
+ handleSizeShowPopover: handleSizeShowPopover({ state, props }),
90
+ handleSizeHidePopover: handleSizeHidePopover({ state }),
91
+ canJumperGo: canJumperGo({ props, state, vm }),
92
+ beforeSizeChangeHandler: beforeSizeChangeHandler({ state, emit }),
93
+ beforePagerChangeHandler: beforePagerChangeHandler({ state, emit }),
94
+ copyEmit: copyEmit({ emit }),
95
+ beforeChangeHandler: beforeChangeHandler({ state, api: api2 }),
96
+ handleCurrentChange: handleCurrentChange({ state, api: api2 }),
97
+ prev: prev({ state, props, api: api2, emit }),
98
+ next: next({ props, state, api: api2, emit }),
99
+ buildBeforePageChangeParam: buildBeforePageChangeParam({ state }),
100
+ emitChange: emitChange({ state, nextTick, emit }),
101
+ setTotal: setTotal({ state }),
102
+ // watch
103
+ watchInternalCurrentPage: watchInternalCurrentPage({ state, emit }),
104
+ watchPageSizes: watchPageSizes({ state, props }),
105
+ watchCurrentPage: watchCurrentPage({ state, api: api2 }),
106
+ watchInternalPageCount: watchInternalPageCount({ state, api: api2 }),
107
+ watchPageSize: watchPageSize({ state }),
108
+ watchTotal: watchTotal({ state })
109
+ });
110
+ state.internalCurrentPage = api2.getValidCurrentPage(props.currentPage);
111
+ watch(() => state.internalCurrentPage, api2.watchInternalCurrentPage);
112
+ watch(() => props.pageSizes, api2.watchPageSizes, { immediate: true });
113
+ watch(() => props.currentPage, api2.watchCurrentPage);
114
+ watch(() => state.internalPageCount, api2.watchInternalPageCount);
115
+ watch(() => props.pageSize, api2.watchPageSize, { immediate: true });
116
+ watch(() => props.total, api2.watchTotal);
5
117
  return api2;
6
118
  };
7
119
  export {
package/picker/index.js CHANGED
@@ -305,7 +305,7 @@ const secondInputId = ({ props, state }) => () => {
305
305
  }
306
306
  return obj;
307
307
  };
308
- const focus = ({ api, props, vm }) => () => !props.ranged ? vm.$refs.reference.focus() : api.handleFocus();
308
+ const focus = ({ api, props, vm }) => () => !props.isRange ? vm.$refs.reference.focus() : api.handleFocus();
309
309
  const blur = (state) => () => state.refInput.forEach((input) => input.blur());
310
310
  const parseValue = ({ api, props, state }) => (value) => {
311
311
  const isParsed = isDateObject(value) || Array.isArray(value) && value.every(isDateObject);