@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,45 +1,181 @@
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 { reactive as e, computed as o, inject as t, getCurrentInstance as l, resolveComponent as n, withDirectives as p, openBlock as a, createElementBlock as r, normalizeClass as s, createElementVNode as i, normalizeStyle as u, vShow as c, createVNode as d, mergeProps as m, withCtx as h, Fragment as v, renderList as f, createBlock as y, createCommentVNode as w, toDisplayString as k, renderSlot as C } from "vue";
7
- import { c as P } from "./component.js";
8
- import S from "./Icon.js";
9
- import x from "./Popup.js";
10
- import { _ } from "./plugin-vue_export-helper.js";
6
+ import { reactive, computed, inject, getCurrentInstance, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createCommentVNode, toDisplayString, renderSlot } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import _sfc_main$1 from "./Icon.js";
9
+ import Popup from "./Popup.js";
10
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
11
11
  import "../locale/lang";
12
12
  import "./pxCheck.js";
13
13
  import "./OverLay.js";
14
- const { componentName: g, create: b } = P("menu-item"), V = b({ props: { title: String, options: { type: Array, default: [] }, disabled: { type: Boolean, default: false }, modelValue: null, cols: { type: Number, default: 1 }, titleIcon: String, optionIcon: { type: String, default: "Check" } }, components: { [S.name]: S, [x.name]: x }, emits: ["update:modelValue", "change"], setup(n2, { emit: p2, slots: a2 }) {
15
- const r2 = e({ showPopup: false, transition: true, showWrapper: false, isShowPlaceholderElement: false }), { parent: s2 } = (() => {
16
- const e2 = t("menuParent", null);
17
- if (e2) {
18
- const o2 = l(), { link: t2 } = e2;
19
- return t2(o2), { parent: e2 };
14
+ const { componentName, create } = createComponent("menu-item");
15
+ const _sfc_main = create({
16
+ props: {
17
+ title: String,
18
+ options: {
19
+ type: Array,
20
+ default: []
21
+ },
22
+ disabled: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ modelValue: null,
27
+ cols: {
28
+ type: Number,
29
+ default: 1
30
+ },
31
+ titleIcon: String,
32
+ optionIcon: {
33
+ type: String,
34
+ default: "Check"
20
35
  }
21
- })();
22
- return { classes: o(() => ({ [g]: true })), placeholderElementStyle: o(() => {
23
- const e2 = { height: s2.offset.value + "px" };
24
- return s2.props.direction === "down" ? e2 : { ...e2, top: "auto" };
25
- }), renderTitle: () => {
26
- var _a;
27
- if (n2.title)
28
- return n2.title;
29
- const e2 = (_a = n2.options) == null ? void 0 : _a.find((e3) => e3.value === n2.modelValue);
30
- return e2 ? e2.text : "";
31
- }, state: r2, parent: s2, toggle: (e2 = !r2.showPopup, o2 = {}) => {
32
- e2 !== r2.showPopup && (r2.showPopup = e2, r2.isShowPlaceholderElement = e2, e2 && (r2.showWrapper = true));
33
- }, onClick: (e2) => {
34
- r2.showPopup = false, r2.isShowPlaceholderElement = false, e2.value !== n2.modelValue && (p2("update:modelValue", e2.value), p2("change", e2.value));
35
- }, handleClose: () => {
36
- r2.showWrapper = false, r2.isShowPlaceholderElement = false;
37
- }, handleClickOutside: () => {
38
- r2.showPopup = false;
39
- } };
40
- } }), E = { class: "nut-menu-item__content" }, j = ["onClick"];
41
- var O = _(V, [["render", function(e2, o2, t2, l2, P2, S2) {
42
- const x2 = n("nut-icon"), _2 = n("nut-popup");
43
- return p((a(), r("view", { class: s(e2.classes) }, [p(i("div", { onClick: o2[0] || (o2[0] = (...o3) => e2.handleClickOutside && e2.handleClickOutside(...o3)), class: s(["placeholder-element", { up: e2.parent.props.direction === "up" }]), style: u(e2.placeholderElementStyle) }, null, 6), [[c, e2.state.isShowPlaceholderElement]]), d(_2, m({ style: e2.parent.props.direction === "down" ? { top: e2.parent.offset.value + "px" } : { bottom: e2.parent.offset.value + "px" }, overlayStyle: e2.parent.props.direction === "down" ? { top: e2.parent.offset.value + "px" } : { bottom: e2.parent.offset.value + "px" } }, e2.$attrs, { visible: e2.state.showPopup, "onUpdate:visible": o2[1] || (o2[1] = (o3) => e2.state.showPopup = o3), position: e2.parent.props.direction === "down" ? "top" : "bottom", duration: e2.parent.props.duration, "pop-class": "nut-menu__pop", overlayClass: "nut-menu__overlay", overlay: e2.parent.props.overlay, onClosed: e2.handleClose, lockScroll: e2.parent.props.lockScroll, isWrapTeleport: false, "close-on-click-overlay": e2.parent.props.closeOnClickOverlay }), { default: h(() => [i("view", E, [(a(true), r(v, null, f(e2.options, (o3, t3) => (a(), r("view", { key: t3, class: s(["nut-menu-item__option", { active: o3.value === e2.modelValue }]), style: u({ "flex-basis": 100 / e2.cols + "%" }), onClick: (t4) => e2.onClick(o3) }, [o3.value === e2.modelValue ? (a(), y(x2, { key: 0, name: e2.optionIcon, color: e2.parent.props.activeColor }, null, 8, ["name", "color"])) : w("", true), i("view", { style: u({ color: o3.value === e2.modelValue ? e2.parent.props.activeColor : "" }) }, k(o3.text), 5)], 14, j))), 128)), C(e2.$slots, "default")])]), _: 3 }, 16, ["style", "overlayStyle", "visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])], 2)), [[c, e2.state.showWrapper]]);
44
- }]]);
45
- export { O as default };
36
+ },
37
+ components: {
38
+ [_sfc_main$1.name]: _sfc_main$1,
39
+ [Popup.name]: Popup
40
+ },
41
+ emits: ["update:modelValue", "change"],
42
+ setup(props, { emit, slots }) {
43
+ const state = reactive({
44
+ showPopup: false,
45
+ transition: true,
46
+ showWrapper: false,
47
+ isShowPlaceholderElement: false
48
+ });
49
+ const useParent = () => {
50
+ const parent2 = inject("menuParent", null);
51
+ if (parent2) {
52
+ const instance = getCurrentInstance();
53
+ const { link } = parent2;
54
+ link(instance);
55
+ return {
56
+ parent: parent2
57
+ };
58
+ }
59
+ };
60
+ const { parent } = useParent();
61
+ const classes = computed(() => {
62
+ const prefixCls = componentName;
63
+ return {
64
+ [prefixCls]: true
65
+ };
66
+ });
67
+ const placeholderElementStyle = computed(() => {
68
+ const heightStyle = { height: parent.offset.value + "px" };
69
+ if (parent.props.direction === "down") {
70
+ return heightStyle;
71
+ } else {
72
+ return { ...heightStyle, top: "auto" };
73
+ }
74
+ });
75
+ const toggle = (show = !state.showPopup, options = {}) => {
76
+ if (show === state.showPopup) {
77
+ return;
78
+ }
79
+ state.showPopup = show;
80
+ state.isShowPlaceholderElement = show;
81
+ if (show) {
82
+ state.showWrapper = true;
83
+ }
84
+ };
85
+ const renderTitle = () => {
86
+ var _a;
87
+ if (props.title) {
88
+ return props.title;
89
+ }
90
+ const match = (_a = props.options) == null ? void 0 : _a.find((option) => option.value === props.modelValue);
91
+ return match ? match.text : "";
92
+ };
93
+ const onClick = (option) => {
94
+ state.showPopup = false;
95
+ state.isShowPlaceholderElement = false;
96
+ if (option.value !== props.modelValue) {
97
+ emit("update:modelValue", option.value);
98
+ emit("change", option.value);
99
+ }
100
+ };
101
+ const handleClose = () => {
102
+ state.showWrapper = false;
103
+ state.isShowPlaceholderElement = false;
104
+ };
105
+ const handleClickOutside = () => {
106
+ state.showPopup = false;
107
+ };
108
+ return {
109
+ classes,
110
+ placeholderElementStyle,
111
+ renderTitle,
112
+ state,
113
+ parent,
114
+ toggle,
115
+ onClick,
116
+ handleClose,
117
+ handleClickOutside
118
+ };
119
+ }
120
+ });
121
+ const _hoisted_1 = { class: "nut-menu-item__content" };
122
+ const _hoisted_2 = ["onClick"];
123
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
124
+ const _component_nut_icon = resolveComponent("nut-icon");
125
+ const _component_nut_popup = resolveComponent("nut-popup");
126
+ return withDirectives((openBlock(), createElementBlock("view", {
127
+ class: normalizeClass(_ctx.classes)
128
+ }, [
129
+ withDirectives(createElementVNode("div", {
130
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClickOutside && _ctx.handleClickOutside(...args)),
131
+ class: normalizeClass(["placeholder-element", { up: _ctx.parent.props.direction === "up" }]),
132
+ style: normalizeStyle(_ctx.placeholderElementStyle)
133
+ }, null, 6), [
134
+ [vShow, _ctx.state.isShowPlaceholderElement]
135
+ ]),
136
+ createVNode(_component_nut_popup, mergeProps({
137
+ style: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px" },
138
+ overlayStyle: _ctx.parent.props.direction === "down" ? { top: _ctx.parent.offset.value + "px" } : { bottom: _ctx.parent.offset.value + "px" }
139
+ }, _ctx.$attrs, {
140
+ visible: _ctx.state.showPopup,
141
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => _ctx.state.showPopup = $event),
142
+ position: _ctx.parent.props.direction === "down" ? "top" : "bottom",
143
+ duration: _ctx.parent.props.duration,
144
+ "pop-class": "nut-menu__pop",
145
+ overlayClass: "nut-menu__overlay",
146
+ overlay: _ctx.parent.props.overlay,
147
+ onClosed: _ctx.handleClose,
148
+ lockScroll: _ctx.parent.props.lockScroll,
149
+ isWrapTeleport: false,
150
+ "close-on-click-overlay": _ctx.parent.props.closeOnClickOverlay
151
+ }), {
152
+ default: withCtx(() => [
153
+ createElementVNode("view", _hoisted_1, [
154
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index2) => {
155
+ return openBlock(), createElementBlock("view", {
156
+ key: index2,
157
+ class: normalizeClass(["nut-menu-item__option", { active: option.value === _ctx.modelValue }]),
158
+ style: normalizeStyle({ "flex-basis": 100 / _ctx.cols + "%" }),
159
+ onClick: ($event) => _ctx.onClick(option)
160
+ }, [
161
+ option.value === _ctx.modelValue ? (openBlock(), createBlock(_component_nut_icon, {
162
+ key: 0,
163
+ name: _ctx.optionIcon,
164
+ color: _ctx.parent.props.activeColor
165
+ }, null, 8, ["name", "color"])) : createCommentVNode("", true),
166
+ createElementVNode("view", {
167
+ style: normalizeStyle({ color: option.value === _ctx.modelValue ? _ctx.parent.props.activeColor : "" })
168
+ }, toDisplayString(option.text), 5)
169
+ ], 14, _hoisted_2);
170
+ }), 128)),
171
+ renderSlot(_ctx.$slots, "default")
172
+ ])
173
+ ]),
174
+ _: 3
175
+ }, 16, ["style", "overlayStyle", "visible", "position", "duration", "overlay", "onClosed", "lockScroll", "close-on-click-overlay"])
176
+ ], 2)), [
177
+ [vShow, _ctx.state.showWrapper]
178
+ ]);
179
+ }
180
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
181
+ export { index as default };
@@ -1,36 +1,198 @@
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, ref as t, computed as l, onMounted as n, nextTick as a, resolveComponent as o, openBlock as i, createElementBlock as c, createElementVNode as s, normalizeClass as r, normalizeStyle as d, createBlock as u, createCommentVNode as f, toDisplayString as v, renderSlot as h } from "vue";
7
- import { c as p } from "./component.js";
8
- import { _ as k } from "./plugin-vue_export-helper.js";
6
+ import { toRefs, ref, computed, onMounted, nextTick, resolveComponent, openBlock, createElementBlock, createElementVNode, normalizeClass, normalizeStyle, createBlock, createCommentVNode, toDisplayString, renderSlot } 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: y, create: g } = p("navbar"), _ = g({ props: { leftShow: { type: Boolean, default: true }, title: { type: String, default: "" }, titIcon: { type: String, default: "" }, leftText: { type: String, default: "" }, desc: { type: String, default: "" }, fixed: { type: Boolean, default: false }, safeAreaInsetTop: { type: Boolean, default: false }, border: { type: Boolean, default: false }, placeholder: { type: Boolean, default: true }, zIndex: { type: [Number, String], default: 10 } }, emits: ["on-click-back", "on-click-title", "on-click-icon", "on-click-right"], setup(o2, { emit: i2 }) {
11
- const { border: c2, fixed: s2, safeAreaInsetTop: r2, placeholder: d2, zIndex: u2 } = e(o2), f2 = t(null), v2 = t(null);
12
- let h2 = t(0);
13
- const p2 = l(() => {
14
- const e2 = y;
15
- return { [e2]: true, [`${e2}--border`]: c2.value, [`${e2}--fixed`]: s2.value, [`${e2}--safe-area-inset-top`]: r2.value };
16
- }), k2 = l(() => ({ zIndex: u2.value }));
17
- return n(() => {
18
- s2.value && d2.value && a(() => {
19
- var _a;
20
- h2 = (_a = v2 == null ? void 0 : v2.value) == null ? void 0 : _a.getBoundingClientRect().height, f2.value.style.height = h2 + "px";
10
+ const { componentName, create } = createComponent("navbar");
11
+ const _sfc_main = create({
12
+ props: {
13
+ leftShow: { type: Boolean, default: true },
14
+ title: { type: String, default: "" },
15
+ titIcon: { type: String, default: "" },
16
+ leftText: { type: String, default: "" },
17
+ desc: { type: String, default: "" },
18
+ fixed: {
19
+ type: Boolean,
20
+ default: false
21
+ },
22
+ safeAreaInsetTop: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ border: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ placeholder: {
31
+ type: Boolean,
32
+ default: true
33
+ },
34
+ zIndex: {
35
+ type: [Number, String],
36
+ default: 10
37
+ }
38
+ },
39
+ emits: ["on-click-back", "on-click-title", "on-click-icon", "on-click-right"],
40
+ setup(props, { emit }) {
41
+ const { border, fixed, safeAreaInsetTop, placeholder, zIndex } = toRefs(props);
42
+ const navBarWrap = ref(null);
43
+ const navBarHtml = ref(null);
44
+ let navHeight = ref(0);
45
+ const classes = computed(() => {
46
+ const prefixCls = componentName;
47
+ return {
48
+ [prefixCls]: true,
49
+ [`${prefixCls}--border`]: border.value,
50
+ [`${prefixCls}--fixed`]: fixed.value,
51
+ [`${prefixCls}--safe-area-inset-top`]: safeAreaInsetTop.value
52
+ };
21
53
  });
22
- }), { navBarWrap: f2, navBarHtml: v2, classes: p2, styles: k2, handleLeft: function() {
23
- i2("on-click-back");
24
- }, handleCenter: function() {
25
- i2("on-click-title");
26
- }, handleCenterIcon: function() {
27
- i2("on-click-icon");
28
- }, handleRight: function() {
29
- i2("on-click-right");
30
- } };
31
- } }), m = { key: 0, class: "nut-navbar--placeholder", ref: "navBarWrap" }, x = { key: 1, class: "nut-navbar__text" }, C = { class: "nut-navbar__title" }, b = { key: 0, class: "nut-navbar__text" }, w = { key: 1, class: "nut-navbar__text" }, I = { class: "nut-navbar__title" }, B = { key: 0, class: "nut-navbar__text" };
32
- var $ = k(_, [["render", function(e2, t2, l2, n2, a2, p2) {
33
- const k2 = o("nut-icon");
34
- return e2.fixed && e2.placeholder ? (i(), c("view", m, [s("view", { class: r(e2.classes), style: d(e2.styles), ref: "navBarHtml" }, [s("view", { class: "nut-navbar__left", onClick: t2[0] || (t2[0] = (...t3) => e2.handleLeft && e2.handleLeft(...t3)) }, [e2.leftShow ? (i(), u(k2, { key: 0, color: "#979797", name: "left" })) : f("", true), e2.leftText ? (i(), c("view", x, v(e2.leftText), 1)) : f("", true), h(e2.$slots, "left")]), s("view", C, [e2.title ? (i(), c("view", { key: 0, class: "title", onClick: t2[1] || (t2[1] = (...t3) => e2.handleCenter && e2.handleCenter(...t3)) }, v(e2.title), 1)) : f("", true), e2.titIcon ? (i(), u(k2, { key: 1, class: "icon", name: e2.titIcon, onClick: e2.handleCenterIcon }, null, 8, ["name", "onClick"])) : f("", true), h(e2.$slots, "content")]), s("view", { class: "nut-navbar__right", onClick: t2[2] || (t2[2] = (...t3) => e2.handleRight && e2.handleRight(...t3)) }, [e2.desc ? (i(), c("view", b, v(e2.desc), 1)) : f("", true), h(e2.$slots, "right")])], 6)], 512)) : (i(), c("view", { key: 1, class: r(e2.classes), style: d(e2.styles) }, [s("view", { class: "nut-navbar__left", onClick: t2[3] || (t2[3] = (...t3) => e2.handleLeft && e2.handleLeft(...t3)) }, [e2.leftShow ? (i(), u(k2, { key: 0, color: "#979797", name: "left" })) : f("", true), e2.leftText ? (i(), c("view", w, v(e2.leftText), 1)) : f("", true), h(e2.$slots, "left")]), s("view", I, [e2.title ? (i(), c("view", { key: 0, class: "title", onClick: t2[4] || (t2[4] = (...t3) => e2.handleCenter && e2.handleCenter(...t3)) }, v(e2.title), 1)) : f("", true), e2.titIcon ? (i(), u(k2, { key: 1, class: "icon", name: e2.titIcon, onClick: e2.handleCenterIcon }, null, 8, ["name", "onClick"])) : f("", true), h(e2.$slots, "content")]), s("view", { class: "nut-navbar__right", onClick: t2[5] || (t2[5] = (...t3) => e2.handleRight && e2.handleRight(...t3)) }, [e2.desc ? (i(), c("view", B, v(e2.desc), 1)) : f("", true), h(e2.$slots, "right")])], 6));
35
- }]]);
36
- export { $ as default };
54
+ const styles = computed(() => {
55
+ return {
56
+ zIndex: zIndex.value
57
+ };
58
+ });
59
+ onMounted(() => {
60
+ if (fixed.value && placeholder.value) {
61
+ nextTick(() => {
62
+ var _a;
63
+ navHeight = (_a = navBarHtml == null ? void 0 : navBarHtml.value) == null ? void 0 : _a.getBoundingClientRect().height;
64
+ navBarWrap.value.style.height = navHeight + "px";
65
+ });
66
+ }
67
+ });
68
+ function handleLeft() {
69
+ emit("on-click-back");
70
+ }
71
+ function handleCenter() {
72
+ emit("on-click-title");
73
+ }
74
+ function handleCenterIcon() {
75
+ emit("on-click-icon");
76
+ }
77
+ function handleRight() {
78
+ emit("on-click-right");
79
+ }
80
+ return {
81
+ navBarWrap,
82
+ navBarHtml,
83
+ classes,
84
+ styles,
85
+ handleLeft,
86
+ handleCenter,
87
+ handleCenterIcon,
88
+ handleRight
89
+ };
90
+ }
91
+ });
92
+ const _hoisted_1 = {
93
+ key: 0,
94
+ class: "nut-navbar--placeholder",
95
+ ref: "navBarWrap"
96
+ };
97
+ const _hoisted_2 = {
98
+ key: 1,
99
+ class: "nut-navbar__text"
100
+ };
101
+ const _hoisted_3 = { class: "nut-navbar__title" };
102
+ const _hoisted_4 = {
103
+ key: 0,
104
+ class: "nut-navbar__text"
105
+ };
106
+ const _hoisted_5 = {
107
+ key: 1,
108
+ class: "nut-navbar__text"
109
+ };
110
+ const _hoisted_6 = { class: "nut-navbar__title" };
111
+ const _hoisted_7 = {
112
+ key: 0,
113
+ class: "nut-navbar__text"
114
+ };
115
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
116
+ const _component_nut_icon = resolveComponent("nut-icon");
117
+ return _ctx.fixed && _ctx.placeholder ? (openBlock(), createElementBlock("view", _hoisted_1, [
118
+ createElementVNode("view", {
119
+ class: normalizeClass(_ctx.classes),
120
+ style: normalizeStyle(_ctx.styles),
121
+ ref: "navBarHtml"
122
+ }, [
123
+ createElementVNode("view", {
124
+ class: "nut-navbar__left",
125
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleLeft && _ctx.handleLeft(...args))
126
+ }, [
127
+ _ctx.leftShow ? (openBlock(), createBlock(_component_nut_icon, {
128
+ key: 0,
129
+ color: "#979797",
130
+ name: "left"
131
+ })) : createCommentVNode("", true),
132
+ _ctx.leftText ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(_ctx.leftText), 1)) : createCommentVNode("", true),
133
+ renderSlot(_ctx.$slots, "left")
134
+ ]),
135
+ createElementVNode("view", _hoisted_3, [
136
+ _ctx.title ? (openBlock(), createElementBlock("view", {
137
+ key: 0,
138
+ class: "title",
139
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleCenter && _ctx.handleCenter(...args))
140
+ }, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
141
+ _ctx.titIcon ? (openBlock(), createBlock(_component_nut_icon, {
142
+ key: 1,
143
+ class: "icon",
144
+ name: _ctx.titIcon,
145
+ onClick: _ctx.handleCenterIcon
146
+ }, null, 8, ["name", "onClick"])) : createCommentVNode("", true),
147
+ renderSlot(_ctx.$slots, "content")
148
+ ]),
149
+ createElementVNode("view", {
150
+ class: "nut-navbar__right",
151
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleRight && _ctx.handleRight(...args))
152
+ }, [
153
+ _ctx.desc ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.desc), 1)) : createCommentVNode("", true),
154
+ renderSlot(_ctx.$slots, "right")
155
+ ])
156
+ ], 6)
157
+ ], 512)) : (openBlock(), createElementBlock("view", {
158
+ key: 1,
159
+ class: normalizeClass(_ctx.classes),
160
+ style: normalizeStyle(_ctx.styles)
161
+ }, [
162
+ createElementVNode("view", {
163
+ class: "nut-navbar__left",
164
+ onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleLeft && _ctx.handleLeft(...args))
165
+ }, [
166
+ _ctx.leftShow ? (openBlock(), createBlock(_component_nut_icon, {
167
+ key: 0,
168
+ color: "#979797",
169
+ name: "left"
170
+ })) : createCommentVNode("", true),
171
+ _ctx.leftText ? (openBlock(), createElementBlock("view", _hoisted_5, toDisplayString(_ctx.leftText), 1)) : createCommentVNode("", true),
172
+ renderSlot(_ctx.$slots, "left")
173
+ ]),
174
+ createElementVNode("view", _hoisted_6, [
175
+ _ctx.title ? (openBlock(), createElementBlock("view", {
176
+ key: 0,
177
+ class: "title",
178
+ onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleCenter && _ctx.handleCenter(...args))
179
+ }, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
180
+ _ctx.titIcon ? (openBlock(), createBlock(_component_nut_icon, {
181
+ key: 1,
182
+ class: "icon",
183
+ name: _ctx.titIcon,
184
+ onClick: _ctx.handleCenterIcon
185
+ }, null, 8, ["name", "onClick"])) : createCommentVNode("", true),
186
+ renderSlot(_ctx.$slots, "content")
187
+ ]),
188
+ createElementVNode("view", {
189
+ class: "nut-navbar__right",
190
+ onClick: _cache[5] || (_cache[5] = (...args) => _ctx.handleRight && _ctx.handleRight(...args))
191
+ }, [
192
+ _ctx.desc ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.desc), 1)) : createCommentVNode("", true),
193
+ renderSlot(_ctx.$slots, "right")
194
+ ])
195
+ ], 6));
196
+ }
197
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
198
+ export { index as default };