@nutui/nutui 3.1.22-beta.5 → 3.1.23-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 (168) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +3 -4
  3. package/dist/nutui.es.js +20412 -4214
  4. package/dist/nutui.umd.js +20518 -4216
  5. package/dist/packages/_es/ActionSheet.js +149 -17
  6. package/dist/packages/_es/Address.js +535 -110
  7. package/dist/packages/_es/AddressList.js +615 -113
  8. package/dist/packages/_es/Animate.js +59 -17
  9. package/dist/packages/_es/Audio.js +257 -53
  10. package/dist/packages/_es/AudioOperate.js +100 -13
  11. package/dist/packages/_es/Avatar.js +162 -38
  12. package/dist/packages/_es/AvatarGroup.js +73 -14
  13. package/dist/packages/_es/BackTop.js +156 -43
  14. package/dist/packages/_es/Badge.js +86 -14
  15. package/dist/packages/_es/Barrage.js +120 -41
  16. package/dist/packages/_es/Button.js +128 -23
  17. package/dist/packages/_es/Calendar.js +246 -30
  18. package/dist/packages/_es/CalendarItem.js +1 -1
  19. package/dist/packages/_es/Card.js +107 -10
  20. package/dist/packages/_es/Cascader.js +496 -147
  21. package/dist/packages/_es/Category.js +58 -15
  22. package/dist/packages/_es/CategoryPane.js +111 -11
  23. package/dist/packages/_es/Cell.js +108 -21
  24. package/dist/packages/_es/CellGroup.js +44 -9
  25. package/dist/packages/_es/Checkbox.js +134 -29
  26. package/dist/packages/_es/CheckboxGroup.js +79 -29
  27. package/dist/packages/_es/CircleProgress.js +150 -28
  28. package/dist/packages/_es/Col.js +56 -14
  29. package/dist/packages/_es/Collapse.js +109 -32
  30. package/dist/packages/_es/CollapseItem.js +253 -59
  31. package/dist/packages/_es/Comment.js +434 -64
  32. package/dist/packages/_es/ConfigProvider.js +20 -8
  33. package/dist/packages/_es/CountDown.js +238 -56
  34. package/dist/packages/_es/CountUp.js +539 -140
  35. package/dist/packages/_es/DatePicker.js +315 -98
  36. package/dist/packages/_es/Dialog.js +289 -60
  37. package/dist/packages/_es/Divider.js +65 -13
  38. package/dist/packages/_es/Drag.js +197 -56
  39. package/dist/packages/_es/Ecard.js +159 -24
  40. package/dist/packages/_es/Elevator.js +255 -58
  41. package/dist/packages/_es/Ellipsis.js +200 -58
  42. package/dist/packages/_es/Empty.js +71 -12
  43. package/dist/packages/_es/FixedNav.js +122 -15
  44. package/dist/packages/_es/Form.js +151 -64
  45. package/dist/packages/_es/FormItem.js +114 -15
  46. package/dist/packages/_es/Grid.js +6 -5
  47. package/dist/packages/_es/GridItem.js +144 -33
  48. package/dist/packages/_es/Icon.js +40 -15
  49. package/dist/packages/_es/Image.js +137 -26
  50. package/dist/packages/_es/ImagePreview.js +547 -76
  51. package/dist/packages/_es/Indicator.js +62 -15
  52. package/dist/packages/_es/InfiniteLoading.js +249 -57
  53. package/dist/packages/_es/Input.js +433 -51
  54. package/dist/packages/_es/InputNumber.js +160 -41
  55. package/dist/packages/_es/Layout.js +5 -4
  56. package/dist/packages/_es/List.js +106 -18
  57. package/dist/packages/_es/Menu.js +168 -44
  58. package/dist/packages/_es/MenuItem.js +173 -37
  59. package/dist/packages/_es/Navbar.js +192 -30
  60. package/dist/packages/_es/NoticeBar.js +380 -74
  61. package/dist/packages/_es/Notify.js +227 -72
  62. package/dist/packages/_es/NumberKeyboard.js +272 -41
  63. package/dist/packages/_es/OldPicker.js +457 -130
  64. package/dist/packages/_es/OverLay.js +98 -24
  65. package/dist/packages/_es/Pagination.js +157 -39
  66. package/dist/packages/_es/Picker.js +454 -129
  67. package/dist/packages/_es/Popover.js +957 -318
  68. package/dist/packages/_es/Popup.js +299 -55
  69. package/dist/packages/_es/Price.js +118 -16
  70. package/dist/packages/_es/Progress.js +146 -14
  71. package/dist/packages/_es/PullRefresh.js +339 -84
  72. package/dist/packages/_es/Radio.js +90 -22
  73. package/dist/packages/_es/RadioGroup.js +37 -8
  74. package/dist/packages/_es/Range.js +408 -83
  75. package/dist/packages/_es/Rate.js +192 -36
  76. package/dist/packages/_es/Row.js +64 -22
  77. package/dist/packages/_es/SearchBar.js +238 -37
  78. package/dist/packages/_es/ShortPassword.js +225 -35
  79. package/dist/packages/_es/SideNavBar.js +81 -24
  80. package/dist/packages/_es/SideNavBarItem.js +46 -11
  81. package/dist/packages/_es/Signature.js +160 -41
  82. package/dist/packages/_es/Skeleton.js +136 -20
  83. package/dist/packages/_es/Sku.js +491 -84
  84. package/dist/packages/_es/Step.js +115 -20
  85. package/dist/packages/_es/Steps.js +53 -18
  86. package/dist/packages/_es/Sticky.js +138 -53
  87. package/dist/packages/_es/SubSideNavBar.js +82 -17
  88. package/dist/packages/_es/Swipe.js +178 -41
  89. package/dist/packages/_es/Swiper.js +433 -121
  90. package/dist/packages/_es/SwiperItem.js +53 -22
  91. package/dist/packages/_es/Switch.js +116 -21
  92. package/dist/packages/_es/TabPane.js +39 -12
  93. package/dist/packages/_es/Tabbar.js +72 -17
  94. package/dist/packages/_es/TabbarItem.js +151 -29
  95. package/dist/packages/_es/Table.js +178 -18
  96. package/dist/packages/_es/Tabs.js +202 -43
  97. package/dist/packages/_es/Tag.js +97 -20
  98. package/dist/packages/_es/TextArea.js +160 -42
  99. package/dist/packages/_es/TimeDetail.js +79 -18
  100. package/dist/packages/_es/TimePannel.js +48 -14
  101. package/dist/packages/_es/TimeSelect.js +112 -15
  102. package/dist/packages/_es/Toast.js +310 -71
  103. package/dist/packages/_es/Uploader.js +455 -104
  104. package/dist/packages/_es/Video.js +332 -74
  105. package/dist/packages/_es/common.js +128 -38
  106. package/dist/packages/_es/component.js +76 -35
  107. package/dist/packages/_es/index.js +6 -5
  108. package/dist/packages/_es/index2.js +30 -9
  109. package/dist/packages/_es/index3.js +8 -6
  110. package/dist/packages/_es/index4.js +64 -13
  111. package/dist/packages/_es/index5.js +780 -164
  112. package/dist/packages/_es/plugin-vue_export-helper.js +8 -7
  113. package/dist/packages/_es/pxCheck.js +5 -3
  114. package/dist/packages/_es/raf.js +15 -8
  115. package/dist/packages/imagepreview/index.scss +6 -1
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.js +105 -5
  118. package/dist/packages/locale/lang/id-ID.js +105 -5
  119. package/dist/packages/locale/lang/index.js +38 -16
  120. package/dist/packages/locale/lang/zh-CN.js +105 -5
  121. package/dist/packages/locale/lang/zh-TW.js +105 -5
  122. package/dist/packages/picker/index.scss +13 -0
  123. package/dist/smartips/attributes.json +8 -0
  124. package/dist/smartips/tags.json +3 -1
  125. package/dist/smartips/web-types.json +19 -1
  126. package/dist/style.css +1 -1
  127. package/dist/style.es.js +1 -1
  128. package/dist/styles/themes/default.scss +49 -49
  129. package/dist/styles/themes/jdb.scss +49 -49
  130. package/dist/styles/themes/jdt.scss +49 -49
  131. package/dist/styles/variables-jdb.scss +4 -1
  132. package/dist/styles/variables-jdt.scss +4 -1
  133. package/dist/styles/variables.scss +1 -1
  134. package/dist/types/__VUE/actionsheet/index.vue.d.ts +3 -3
  135. package/dist/types/__VUE/address/index.vue.d.ts +4 -4
  136. package/dist/types/__VUE/calendar/index.vue.d.ts +1 -1
  137. package/dist/types/__VUE/cascader/index.vue.d.ts +3 -3
  138. package/dist/types/__VUE/cell/index.vue.d.ts +2 -2
  139. package/dist/types/__VUE/checkbox/index.vue.d.ts +2 -2
  140. package/dist/types/__VUE/collapse/index.vue.d.ts +2 -2
  141. package/dist/types/__VUE/datepicker/index.vue.d.ts +2 -2
  142. package/dist/types/__VUE/dialog/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/ecard/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/grid/index.vue.d.ts +3 -3
  146. package/dist/types/__VUE/imagepreview/imagePreviewItem.vue.d.ts +95 -0
  147. package/dist/types/__VUE/imagepreview/index.vue.d.ts +23 -25
  148. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  149. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  150. package/dist/types/__VUE/menu/index.vue.d.ts +4 -4
  151. package/dist/types/__VUE/menuitem/index.vue.d.ts +1 -1
  152. package/dist/types/__VUE/numberkeyboard/index.vue.d.ts +2 -2
  153. package/dist/types/__VUE/oldpicker/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/picker/index.vue.d.ts +3 -3
  155. package/dist/types/__VUE/popover/index.vue.d.ts +6 -6
  156. package/dist/types/__VUE/popup/index.vue.d.ts +4 -4
  157. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  158. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  159. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/shortpassword/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/sku/index.vue.d.ts +3 -3
  162. package/dist/types/__VUE/swipe/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/tabbar/index.vue.d.ts +2 -2
  165. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/toast/index.vue.d.ts +1 -1
  167. package/dist/types/index.d.ts +1 -1
  168. package/package.json +1 -2
@@ -1,17 +1,76 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { toRefs as e, computed as t, openBlock as s, createElementBlock as a, createElementVNode as i, normalizeStyle as l, renderSlot as r, Fragment as p, createCommentVNode as m, toDisplayString as o } from "vue";
7
- import { c } from "./component.js";
8
- import { _ as n } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, renderSlot, Fragment, createCommentVNode, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const { componentName: u, create: g, translate: d } = c("empty"), y = { empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png", error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png", network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png" }, f = g({ props: { image: { type: String, default: "empty" }, imageSize: { type: [Number, String], default: "" }, description: { type: String, default: "" } }, setup(s2) {
11
- const { image: a2, imageSize: i2 } = e(s2), l2 = t(() => i2.value ? typeof i2.value == "number" ? `width:${i2.value}px;height:${i2.value}px` : `width:${i2.value};height:${i2.value}` : "");
12
- return { imageUrl: a2.value.startsWith("https://") || a2.value.startsWith("http://") || a2.value.startsWith("//") ? a2.value : y[a2.value], imgStyle: l2, translate: d };
13
- } }), v = { class: "nut-empty" }, h = ["src"], $ = { key: 1, class: "nut-empty-description" };
14
- var k = n(f, [["render", function(e2, t2, c2, n2, u2, g2) {
15
- return s(), a("view", v, [i("view", { class: "nut-empty-image", style: l(e2.imgStyle) }, [e2.$slots.image ? r(e2.$slots, "image", { key: 0 }) : (s(), a(p, { key: 1 }, [e2.imageUrl ? (s(), a("img", { key: 0, class: "img", src: e2.imageUrl }, null, 8, h)) : m("", true)], 64))], 4), e2.$slots.description ? r(e2.$slots, "description", { key: 0 }) : (s(), a("view", $, o(e2.description || e2.translate("noData")), 1)), e2.$slots.default ? r(e2.$slots, "default", { key: 2 }) : m("", true)]);
16
- }]]);
17
- export { k as default };
10
+ const { componentName, create, translate } = createComponent("empty");
11
+ const defaultStatus = {
12
+ empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
13
+ error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
14
+ network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
15
+ };
16
+ const _sfc_main = create({
17
+ props: {
18
+ image: {
19
+ type: String,
20
+ default: "empty"
21
+ },
22
+ imageSize: {
23
+ type: [Number, String],
24
+ default: ""
25
+ },
26
+ description: {
27
+ type: String,
28
+ default: ""
29
+ }
30
+ },
31
+ setup(props) {
32
+ const { image, imageSize } = toRefs(props);
33
+ const imgStyle = computed(() => {
34
+ if (!imageSize.value) {
35
+ return "";
36
+ }
37
+ if (typeof imageSize.value === "number") {
38
+ return `width:${imageSize.value}px;height:${imageSize.value}px`;
39
+ }
40
+ return `width:${imageSize.value};height:${imageSize.value}`;
41
+ });
42
+ const isHttpUrl = image.value.startsWith("https://") || image.value.startsWith("http://") || image.value.startsWith("//");
43
+ const imageUrl = isHttpUrl ? image.value : defaultStatus[image.value];
44
+ return {
45
+ imageUrl,
46
+ imgStyle,
47
+ translate
48
+ };
49
+ }
50
+ });
51
+ const _hoisted_1 = { class: "nut-empty" };
52
+ const _hoisted_2 = ["src"];
53
+ const _hoisted_3 = {
54
+ key: 1,
55
+ class: "nut-empty-description"
56
+ };
57
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
58
+ return openBlock(), createElementBlock("view", _hoisted_1, [
59
+ createElementVNode("view", {
60
+ class: "nut-empty-image",
61
+ style: normalizeStyle(_ctx.imgStyle)
62
+ }, [
63
+ _ctx.$slots.image ? renderSlot(_ctx.$slots, "image", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
64
+ _ctx.imageUrl ? (openBlock(), createElementBlock("img", {
65
+ key: 0,
66
+ class: "img",
67
+ src: _ctx.imageUrl
68
+ }, null, 8, _hoisted_2)) : createCommentVNode("", true)
69
+ ], 64))
70
+ ], 4),
71
+ _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description || _ctx.translate("noData")), 1)),
72
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("", true)
73
+ ]);
74
+ }
75
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
76
+ export { index as default };
@@ -1,20 +1,127 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed as e, resolveComponent as t, openBlock as i, createElementBlock as l, normalizeClass as s, normalizeStyle as a, createBlock as n, createCommentVNode as o, renderSlot as c, createElementVNode as u, Fragment as v, renderList as r, toDisplayString as p, createVNode as d } from "vue";
7
- import { c as m } from "./component.js";
8
- import f from "./OverLay.js";
9
- import { _ as y } from "./plugin-vue_export-helper.js";
6
+ import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createBlock, createCommentVNode, renderSlot, createElementVNode, Fragment, renderList, toDisplayString, createVNode } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import overlay from "./OverLay.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName: x, create: b, translate: _ } = m("fixednav"), g = b({ components: { [f.name]: f }, props: { visible: { type: Boolean, default: false }, overlay: { type: Boolean, default: true }, navList: { default: () => [], type: Array }, activeText: { default: "", type: String }, unActiveText: { default: "", type: String }, position: { default: () => ({ top: "auto", bottom: "auto" }), type: Object }, type: { default: "right", type: String } }, emits: ["update:visible", "selected"], setup: (t2, { emit: i2 }) => ({ classes: e(() => ({ [x]: true, active: t2.visible, [t2.type]: true })), updateValue: (e2 = !t2.visible) => {
12
- i2("update:visible", e2);
13
- }, selected: (e2, t3) => {
14
- i2("selected", { item: e2, event: t3 });
15
- }, translate: _ }) }), k = { class: "nut-fixednav__list" }, w = ["onClick"], T = ["src"], j = { class: "span" }, A = { key: 0, class: "b" }, C = { class: "text" };
16
- var L = y(g, [["render", function(e2, m2, f2, y2, x2, b2) {
17
- const _2 = t("nut-overlay"), g2 = t("nut-icon");
18
- return i(), l("view", { class: s(e2.classes), style: a(e2.position) }, [e2.overlay ? (i(), n(_2, { key: 0, visible: e2.visible, "z-index": 200, onClick: m2[0] || (m2[0] = (t2) => e2.updateValue(false)) }, null, 8, ["visible"])) : o("", true), c(e2.$slots, "list", {}, () => [u("view", k, [(i(true), l(v, null, r(e2.navList, (t2, s2) => (i(), l("view", { class: "nut-fixednav__list-item", onClick: (i2) => e2.selected(t2, i2), key: t2.id || s2 }, [u("img", { src: t2.icon }, null, 8, T), u("view", j, p(t2.text), 1), t2.num ? (i(), l("view", A, p(t2.num), 1)) : o("", true)], 8, w))), 128))])]), u("div", { class: "nut-fixednav__btn", onClick: m2[1] || (m2[1] = (t2) => e2.updateValue()) }, [c(e2.$slots, "btn", {}, () => [d(g2, { name: "left", color: "#fff" }), u("view", C, p(e2.visible ? e2.activeText || e2.translate("activeText") : e2.unActiveText || e2.translate("unActiveText")), 1)])])], 6);
19
- }]]);
20
- export { L as default };
11
+ const { componentName, create, translate } = createComponent("fixednav");
12
+ const _sfc_main = create({
13
+ components: {
14
+ [overlay.name]: overlay
15
+ },
16
+ props: {
17
+ visible: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ overlay: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ navList: {
26
+ default: () => [],
27
+ type: Array
28
+ },
29
+ activeText: {
30
+ default: "",
31
+ type: String
32
+ },
33
+ unActiveText: {
34
+ default: "",
35
+ type: String
36
+ },
37
+ position: {
38
+ default: () => {
39
+ return {
40
+ top: "auto",
41
+ bottom: "auto"
42
+ };
43
+ },
44
+ type: Object
45
+ },
46
+ type: {
47
+ default: "right",
48
+ type: String
49
+ }
50
+ },
51
+ emits: ["update:visible", "selected"],
52
+ setup(props, { emit }) {
53
+ const classes = computed(() => {
54
+ const prefixCls = componentName;
55
+ return {
56
+ [prefixCls]: true,
57
+ active: props.visible,
58
+ [props.type]: true
59
+ };
60
+ });
61
+ const updateValue = (value = !props.visible) => {
62
+ emit("update:visible", value);
63
+ };
64
+ const selected = (item, event) => {
65
+ emit("selected", {
66
+ item,
67
+ event
68
+ });
69
+ };
70
+ return { classes, updateValue, selected, translate };
71
+ }
72
+ });
73
+ const _hoisted_1 = { class: "nut-fixednav__list" };
74
+ const _hoisted_2 = ["onClick"];
75
+ const _hoisted_3 = ["src"];
76
+ const _hoisted_4 = { class: "span" };
77
+ const _hoisted_5 = {
78
+ key: 0,
79
+ class: "b"
80
+ };
81
+ const _hoisted_6 = { class: "text" };
82
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
83
+ const _component_nut_overlay = resolveComponent("nut-overlay");
84
+ const _component_nut_icon = resolveComponent("nut-icon");
85
+ return openBlock(), createElementBlock("view", {
86
+ class: normalizeClass(_ctx.classes),
87
+ style: normalizeStyle(_ctx.position)
88
+ }, [
89
+ _ctx.overlay ? (openBlock(), createBlock(_component_nut_overlay, {
90
+ key: 0,
91
+ visible: _ctx.visible,
92
+ "z-index": 200,
93
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.updateValue(false))
94
+ }, null, 8, ["visible"])) : createCommentVNode("", true),
95
+ renderSlot(_ctx.$slots, "list", {}, () => [
96
+ createElementVNode("view", _hoisted_1, [
97
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.navList, (item, index2) => {
98
+ return openBlock(), createElementBlock("view", {
99
+ class: "nut-fixednav__list-item",
100
+ onClick: ($event) => _ctx.selected(item, $event),
101
+ key: item.id || index2
102
+ }, [
103
+ createElementVNode("img", {
104
+ src: item.icon
105
+ }, null, 8, _hoisted_3),
106
+ createElementVNode("view", _hoisted_4, toDisplayString(item.text), 1),
107
+ item.num ? (openBlock(), createElementBlock("view", _hoisted_5, toDisplayString(item.num), 1)) : createCommentVNode("", true)
108
+ ], 8, _hoisted_2);
109
+ }), 128))
110
+ ])
111
+ ]),
112
+ createElementVNode("div", {
113
+ class: "nut-fixednav__btn",
114
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.updateValue())
115
+ }, [
116
+ renderSlot(_ctx.$slots, "btn", {}, () => [
117
+ createVNode(_component_nut_icon, {
118
+ name: "left",
119
+ color: "#fff"
120
+ }),
121
+ createElementVNode("view", _hoisted_6, toDisplayString(_ctx.visible ? _ctx.activeText || _ctx.translate("activeText") : _ctx.unActiveText || _ctx.translate("unActiveText")), 1)
122
+ ])
123
+ ])
124
+ ], 6);
125
+ }
126
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
127
+ export { index as default };
@@ -1,71 +1,158 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { i as e, g as r, a as t, c as o } from "./component.js";
7
- import { computed as l, reactive as s, provide as n, watch as a, resolveComponent as i, openBlock as m, createElementBlock as p, withModifiers as u, createVNode as c, withCtx as d, renderSlot as f } from "vue";
8
- import { _ as h } from "./plugin-vue_export-helper.js";
6
+ import { i as isObject, g as getPropByPath, a as isPromise, c as createComponent } from "./component.js";
7
+ import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const v = { props: { modelValue: { type: Object, default: {} } }, components: {}, emits: ["validate"], setup(o2, { emit: i2, slots: m2 }) {
11
- const p2 = l(() => s({}));
12
- n("formErrorTip", p2);
13
- const u2 = (e2 = o2.modelValue) => {
14
- Object.keys(p2.value).forEach((e3) => {
15
- p2.value[e3] = "";
16
- });
17
- };
18
- a(() => o2.modelValue, (e2) => {
19
- u2(e2);
20
- }, { immediate: true });
21
- const c2 = (r2) => {
22
- let t2 = [];
23
- return r2.forEach((r3, o3) => {
24
- var _a, _b, _c, _d;
25
- let l2 = r3.type;
26
- l2 = l2.name || l2, l2 == "nut-form-item" ? t2.push({ prop: (_a = r3.props) == null ? void 0 : _a.prop, rules: ((_b = r3.props) == null ? void 0 : _b.rules) || [] }) : Array.isArray(r3.children) && ((_c = r3.children) == null ? void 0 : _c.length) ? t2 = t2.concat(c2(r3.children)) : e(r3.children) && Object.keys(r3.children) && ((_d = r3.children) == null ? void 0 : _d.default) && (r3.children = r3.children.default(), t2 = t2.concat(c2(r3.children)));
27
- }), t2;
28
- }, d2 = (e2) => {
29
- e2.message && i2("validate", e2), p2.value[e2.prop] = e2.message;
30
- }, f2 = (e2) => {
31
- const { rules: l2, prop: s2 } = e2, n2 = (e3) => new Promise((r2, t2) => {
32
- d2(e3), r2(e3);
33
- });
34
- let a2 = r(o2.modelValue, s2 || "");
35
- d2({ prop: s2, message: "" });
36
- let i3 = [...l2];
37
- for (; i3.length; ) {
38
- const { required: e3, validator: r2, regex: o3, message: l3 } = i3.shift(), m3 = { prop: s2, message: l3 };
39
- if (e3 && !a2)
40
- return n2(m3);
41
- if (o3 && !o3.test(String(a2)))
42
- return n2(m3);
43
- if (r2) {
44
- const e4 = r2(a2);
45
- if (t(e4))
46
- return new Promise((r3, t2) => {
47
- e4.then((e5) => {
48
- e5 ? r3(true) : (d2(m3), r3(m3));
49
- });
10
+ const component = {
11
+ props: {
12
+ modelValue: {
13
+ type: Object,
14
+ default: {}
15
+ }
16
+ },
17
+ components: {},
18
+ emits: ["validate"],
19
+ setup(props, { emit, slots }) {
20
+ const formErrorTip = computed(() => reactive({}));
21
+ provide("formErrorTip", formErrorTip);
22
+ const clearErrorTips = (value = props.modelValue) => {
23
+ Object.keys(formErrorTip.value).forEach((item) => {
24
+ formErrorTip.value[item] = "";
25
+ });
26
+ };
27
+ const reset = () => {
28
+ clearErrorTips();
29
+ };
30
+ watch(() => props.modelValue, (value) => {
31
+ clearErrorTips(value);
32
+ }, { immediate: true });
33
+ const findFormItem = (vnodes) => {
34
+ let task = [];
35
+ vnodes.forEach((vnode, index2) => {
36
+ var _a, _b, _c, _d;
37
+ let type = vnode.type;
38
+ type = type.name || type;
39
+ if (type == "nut-form-item") {
40
+ task.push({
41
+ prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
42
+ rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
50
43
  });
51
- if (!e4)
52
- return n2(m3);
44
+ } else if (Array.isArray(vnode.children) && ((_c = vnode.children) == null ? void 0 : _c.length)) {
45
+ task = task.concat(findFormItem(vnode.children));
46
+ } else if (isObject(vnode.children) && Object.keys(vnode.children)) {
47
+ if ((_d = vnode.children) == null ? void 0 : _d.default) {
48
+ vnode.children = vnode.children.default();
49
+ task = task.concat(findFormItem(vnode.children));
50
+ }
51
+ }
52
+ });
53
+ return task;
54
+ };
55
+ const tipMessage = (errorMsg) => {
56
+ if (errorMsg.message) {
57
+ emit("validate", errorMsg);
53
58
  }
54
- }
55
- return Promise.resolve(true);
56
- }, h2 = (e2 = "") => new Promise((r2, t2) => {
57
- let o3 = c2(m2.default()).map((r3) => e2 ? e2 == r3.prop ? f2(r3) : Promise.resolve(true) : f2(r3));
58
- Promise.all(o3).then((e3) => {
59
- const t3 = { valid: true, errors: [] };
60
- (e3 = e3.filter((e4) => e4 != 1)).length && (t3.valid = false, t3.errors = e3), r2(t3);
61
- });
62
- });
63
- return { validate: h2, reset: () => {
64
- u2();
65
- }, onSubmit: () => (h2(), false), formErrorTip: p2 };
66
- } }, { create: g } = o("form");
67
- var y = h(g(v), [["render", function(e2, r2, t2, o2, l2, s2) {
68
- const n2 = i("nut-cell-group");
69
- return m(), p("form", { class: "nut-form", action: "#", onSubmit: r2[0] || (r2[0] = u(() => false, ["prevent"])) }, [c(n2, null, { default: d(() => [f(e2.$slots, "default")]), _: 3 })], 32);
70
- }]]);
71
- export { y as default };
59
+ formErrorTip.value[errorMsg.prop] = errorMsg.message;
60
+ };
61
+ const checkRule = (item) => {
62
+ const { rules, prop } = item;
63
+ const _Promise = (errorMsg) => {
64
+ return new Promise((resolve, reject) => {
65
+ tipMessage(errorMsg);
66
+ resolve(errorMsg);
67
+ });
68
+ };
69
+ if (!prop) {
70
+ console.warn("[NutUI] <FormItem> \u4F7F\u7528 rules \u6821\u9A8C\u89C4\u5219\u65F6 , \u5FC5\u987B\u8BBE\u7F6E prop \u53C2\u6570");
71
+ }
72
+ let value = getPropByPath(props.modelValue, prop || "");
73
+ tipMessage({ prop, message: "" });
74
+ let _rules = [...rules];
75
+ while (_rules.length) {
76
+ const { required, validator, regex, message } = _rules.shift();
77
+ const errorMsg = { prop, message };
78
+ if (required) {
79
+ if (!value) {
80
+ return _Promise(errorMsg);
81
+ }
82
+ }
83
+ if (regex && !regex.test(String(value))) {
84
+ return _Promise(errorMsg);
85
+ }
86
+ if (validator) {
87
+ const result = validator(value);
88
+ if (isPromise(result)) {
89
+ return new Promise((r, j) => {
90
+ result.then((res) => {
91
+ if (!res) {
92
+ tipMessage(errorMsg);
93
+ r(errorMsg);
94
+ } else {
95
+ r(true);
96
+ }
97
+ });
98
+ });
99
+ } else {
100
+ if (!result) {
101
+ return _Promise(errorMsg);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ return Promise.resolve(true);
107
+ };
108
+ const validate = (customProp = "") => {
109
+ return new Promise((resolve, reject) => {
110
+ let task = findFormItem(slots.default());
111
+ let errors = task.map((item) => {
112
+ if (customProp) {
113
+ if (customProp == item.prop) {
114
+ return checkRule(item);
115
+ } else {
116
+ return Promise.resolve(true);
117
+ }
118
+ } else {
119
+ return checkRule(item);
120
+ }
121
+ });
122
+ Promise.all(errors).then((errorRes) => {
123
+ errorRes = errorRes.filter((item) => item != true);
124
+ const res = { valid: true, errors: [] };
125
+ if (errorRes.length) {
126
+ res.valid = false;
127
+ res.errors = errorRes;
128
+ }
129
+ resolve(res);
130
+ });
131
+ });
132
+ };
133
+ const onSubmit = () => {
134
+ validate();
135
+ return false;
136
+ };
137
+ return { validate, reset, onSubmit, formErrorTip };
138
+ }
139
+ };
140
+ const { create } = createComponent("form");
141
+ const _sfc_main = create(component);
142
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
143
+ const _component_nut_cell_group = resolveComponent("nut-cell-group");
144
+ return openBlock(), createElementBlock("form", {
145
+ class: "nut-form",
146
+ action: "#",
147
+ onSubmit: _cache[0] || (_cache[0] = withModifiers(() => false, ["prevent"]))
148
+ }, [
149
+ createVNode(_component_nut_cell_group, null, {
150
+ default: withCtx(() => [
151
+ renderSlot(_ctx.$slots, "default")
152
+ ]),
153
+ _: 3
154
+ })
155
+ ], 32);
156
+ }
157
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
158
+ export { index as default };
@@ -1,20 +1,119 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { p as e } from "./pxCheck.js";
7
- import { inject as t, provide as r, computed as l, resolveComponent as o, openBlock as s, createBlock as a, normalizeClass as n, normalizeStyle as i, withCtx as p, createElementBlock as u, renderSlot as y, createTextVNode as m, toDisplayString as d, createCommentVNode as f, createElementVNode as g } from "vue";
8
- import { c } from "./component.js";
9
- import { _ as b } from "./plugin-vue_export-helper.js";
6
+ import { p as pxCheck } from "./pxCheck.js";
7
+ import { inject, provide, computed, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
8
+ import { c as createComponent } from "./component.js";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName: _, create: S } = c("form-item"), A = S({ inheritAttrs: false, props: { prop: { type: String, default: "" }, label: { type: String, default: "" }, rules: { type: Array, default: () => [] }, required: { type: Boolean, default: false }, showErrorMessage: { type: Boolean, default: true }, showErrorLine: { type: Boolean, default: true }, labelWidth: { type: [String, Number], default: "" }, labelAlign: { type: String, default: "" }, errorMessageAlign: { type: String, default: "" }, bodyAlign: { type: String, default: "" } }, components: {}, emits: [""], setup(o2, { emit: s2 }) {
12
- const a2 = t("formErrorTip");
13
- r("form", { props: o2 });
14
- return { parent: a2, labelStyle: l(() => ({ width: e(o2.labelWidth), textAlign: o2.labelAlign })), bodyStyle: l(() => ({ textAlign: o2.bodyAlign })), errorMessageStyle: l(() => ({ textAlign: o2.errorMessageAlign })) };
15
- } }), h = { class: "nut-cell__value nut-form-item__body" };
16
- var w = b(A, [["render", function(e2, t2, r2, l2, c2, b2) {
17
- const _2 = o("nut-cell");
18
- return s(), a(_2, { class: n(["nut-form-item", [{ error: e2.parent[e2.prop], line: e2.showErrorLine }, e2.$attrs.class]]), style: i(e2.$attrs.style) }, { default: p(() => [e2.label ? (s(), u("view", { key: 0, class: n(["nut-cell__title nut-form-item__label", { required: e2.required }]), style: i(e2.labelStyle) }, [y(e2.$slots, "label", {}, () => [m(d(e2.label), 1)])], 6)) : f("", true), g("view", h, [g("view", { class: "nut-form-item__body__slots", style: i(e2.bodyStyle) }, [y(e2.$slots, "default")], 4), e2.parent[e2.prop] && e2.showErrorMessage ? (s(), u("view", { key: 0, class: "nut-form-item__body__tips", style: i(e2.errorMessageStyle) }, d(e2.parent[e2.prop]), 5)) : f("", true)])]), _: 3 }, 8, ["class", "style"]);
19
- }]]);
20
- export { w as default };
11
+ const { componentName, create } = createComponent("form-item");
12
+ const _sfc_main = create({
13
+ inheritAttrs: false,
14
+ props: {
15
+ prop: {
16
+ type: String,
17
+ default: ""
18
+ },
19
+ label: {
20
+ type: String,
21
+ default: ""
22
+ },
23
+ rules: {
24
+ type: Array,
25
+ default: () => {
26
+ return [];
27
+ }
28
+ },
29
+ required: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ showErrorMessage: {
34
+ type: Boolean,
35
+ default: true
36
+ },
37
+ showErrorLine: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ labelWidth: {
42
+ type: [String, Number],
43
+ default: ""
44
+ },
45
+ labelAlign: {
46
+ type: String,
47
+ default: ""
48
+ },
49
+ errorMessageAlign: {
50
+ type: String,
51
+ default: ""
52
+ },
53
+ bodyAlign: {
54
+ type: String,
55
+ default: ""
56
+ }
57
+ },
58
+ components: {},
59
+ emits: [""],
60
+ setup(props, { emit }) {
61
+ const parent = inject("formErrorTip");
62
+ provide("form", {
63
+ props
64
+ });
65
+ const labelStyle = computed(() => {
66
+ return {
67
+ width: pxCheck(props.labelWidth),
68
+ textAlign: props.labelAlign
69
+ };
70
+ });
71
+ const bodyStyle = computed(() => {
72
+ return {
73
+ textAlign: props.bodyAlign
74
+ };
75
+ });
76
+ const errorMessageStyle = computed(() => {
77
+ return {
78
+ textAlign: props.errorMessageAlign
79
+ };
80
+ });
81
+ return { parent, labelStyle, bodyStyle, errorMessageStyle };
82
+ }
83
+ });
84
+ const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
85
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
86
+ const _component_nut_cell = resolveComponent("nut-cell");
87
+ return openBlock(), createBlock(_component_nut_cell, {
88
+ class: normalizeClass(["nut-form-item", [{ error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class]]),
89
+ style: normalizeStyle(_ctx.$attrs.style)
90
+ }, {
91
+ default: withCtx(() => [
92
+ _ctx.label ? (openBlock(), createElementBlock("view", {
93
+ key: 0,
94
+ class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
95
+ style: normalizeStyle(_ctx.labelStyle)
96
+ }, [
97
+ renderSlot(_ctx.$slots, "label", {}, () => [
98
+ createTextVNode(toDisplayString(_ctx.label), 1)
99
+ ])
100
+ ], 6)) : createCommentVNode("", true),
101
+ createElementVNode("view", _hoisted_1, [
102
+ createElementVNode("view", {
103
+ class: "nut-form-item__body__slots",
104
+ style: normalizeStyle(_ctx.bodyStyle)
105
+ }, [
106
+ renderSlot(_ctx.$slots, "default")
107
+ ], 4),
108
+ _ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
109
+ key: 0,
110
+ class: "nut-form-item__body__tips",
111
+ style: normalizeStyle(_ctx.errorMessageStyle)
112
+ }, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
113
+ ])
114
+ ]),
115
+ _: 3
116
+ }, 8, ["class", "style"]);
117
+ }
118
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
119
+ export { index as default };
@@ -1,12 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.23-beta.1 Mon Jun 27 2022 21:39:05 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as o } from "./component.js";
7
- import { c as m } from "./common.js";
6
+ import { c as createComponent } from "./component.js";
7
+ import { c as component } from "./common.js";
8
8
  import "vue";
9
9
  import "../locale/lang";
10
10
  import "./pxCheck.js";
11
- const { create: r } = o("grid"), t = r(m);
12
- export { t as default };
11
+ const { create } = createComponent("grid");
12
+ const _sfc_main = create(component);
13
+ export { _sfc_main as default };