persagy-vant 0.0.42 → 0.0.44

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 (67) hide show
  1. package/es/action-sheet/ActionSheet.d.ts +4 -0
  2. package/es/action-sheet/ActionSheet.mjs +4 -1
  3. package/es/action-sheet/index.css +1 -1
  4. package/es/action-sheet/index.d.ts +3 -0
  5. package/es/action-sheet/index.less +4 -0
  6. package/es/index.d.ts +1 -1
  7. package/es/index.mjs +1 -1
  8. package/es/locale/lang/en-US.d.ts +6 -0
  9. package/es/locale/lang/en-US.mjs +6 -0
  10. package/es/locale/lang/zh-CN.d.ts +6 -0
  11. package/es/locale/lang/zh-CN.mjs +6 -0
  12. package/es/object-select/ObjectSelect.d.ts +7 -2
  13. package/es/object-select/ObjectSelect.mjs +26 -13
  14. package/es/object-select/index.d.ts +5 -1
  15. package/es/tree-select/TreeSelect.d.ts +7 -1
  16. package/es/tree-select/TreeSelect.mjs +107 -54
  17. package/es/tree-select/index.css +1 -1
  18. package/es/tree-select/index.d.ts +6 -2
  19. package/es/tree-select/index.less +6 -0
  20. package/es/tree-select/style/index.mjs +1 -0
  21. package/es/tree-select/style/less.mjs +1 -0
  22. package/es/uploader/Uploader.d.ts +6 -1
  23. package/es/uploader/Uploader.mjs +80 -19
  24. package/es/uploader/index.css +1 -1
  25. package/es/uploader/index.d.ts +6 -2
  26. package/es/uploader/index.less +4 -0
  27. package/es/uploader/style/index.mjs +3 -0
  28. package/es/uploader/style/less.mjs +3 -0
  29. package/es/uploader/types.d.ts +2 -1
  30. package/lib/action-sheet/ActionSheet.d.ts +4 -0
  31. package/lib/action-sheet/ActionSheet.js +4 -1
  32. package/lib/action-sheet/index.css +1 -1
  33. package/lib/action-sheet/index.d.ts +3 -0
  34. package/lib/action-sheet/index.less +4 -0
  35. package/lib/index.css +1 -1
  36. package/lib/index.d.ts +1 -1
  37. package/lib/index.js +1 -1
  38. package/lib/locale/lang/en-US.d.ts +6 -0
  39. package/lib/locale/lang/en-US.js +6 -0
  40. package/lib/locale/lang/zh-CN.d.ts +6 -0
  41. package/lib/locale/lang/zh-CN.js +6 -0
  42. package/lib/object-select/ObjectSelect.d.ts +7 -2
  43. package/lib/object-select/ObjectSelect.js +25 -12
  44. package/lib/object-select/index.d.ts +5 -1
  45. package/lib/tree-select/TreeSelect.d.ts +7 -1
  46. package/lib/tree-select/TreeSelect.js +107 -52
  47. package/lib/tree-select/index.css +1 -1
  48. package/lib/tree-select/index.d.ts +6 -2
  49. package/lib/tree-select/index.less +6 -0
  50. package/lib/tree-select/style/index.js +1 -0
  51. package/lib/tree-select/style/less.js +1 -0
  52. package/lib/uploader/Uploader.d.ts +6 -1
  53. package/lib/uploader/Uploader.js +79 -18
  54. package/lib/uploader/index.css +1 -1
  55. package/lib/uploader/index.d.ts +6 -2
  56. package/lib/uploader/index.less +4 -0
  57. package/lib/uploader/style/index.js +3 -0
  58. package/lib/uploader/style/less.js +3 -0
  59. package/lib/uploader/types.d.ts +2 -1
  60. package/lib/vant.cjs.js +232 -98
  61. package/lib/vant.es.js +233 -99
  62. package/lib/vant.js +232 -98
  63. package/lib/vant.min.js +1 -1
  64. package/lib/web-types.json +1 -1
  65. package/package.json +1 -1
  66. package/skills/use-persagy-vant/references/business-component-catalog.md +1 -1
  67. package/skills/use-persagy-vant/references/component-catalog.md +2 -2
package/lib/vant.cjs.js CHANGED
@@ -301,6 +301,12 @@ var stdin_default$29 = {
301
301
  },
302
302
  vanTabs: {
303
303
  moreTitle: "更多标签"
304
+ },
305
+ vanUploader: {
306
+ sourcePickerTitle: "选择上传方式",
307
+ takePhoto: "拍照",
308
+ recordVideo: "拍视频",
309
+ chooseFromAlbum: "从相册选择"
304
310
  }
305
311
  };
306
312
  const lang = vue.ref("zh-CN");
@@ -1786,6 +1792,7 @@ const actionSheetProps = extend({}, popupSharedProps, {
1786
1792
  closeable: truthProp,
1787
1793
  cancelText: String,
1788
1794
  description: String,
1795
+ contentAdaptive: Boolean,
1789
1796
  closeOnPopstate: truthProp,
1790
1797
  closeOnClickAction: Boolean,
1791
1798
  safeAreaInsetBottom: truthProp
@@ -1894,7 +1901,9 @@ var stdin_default$1W = vue.defineComponent({
1894
1901
  }
1895
1902
  };
1896
1903
  return () => vue.createVNode(Popup, vue.mergeProps({
1897
- "class": bem$1I(),
1904
+ "class": bem$1I({
1905
+ "content-adaptive": props2.contentAdaptive
1906
+ }),
1898
1907
  "position": "bottom",
1899
1908
  "onUpdate:show": updateShow
1900
1909
  }, pick(props2, popupInheritKeys$2)), {
@@ -7601,21 +7610,21 @@ var stdin_default$1o = vue.defineComponent({
7601
7610
  }, [renderChildren()]);
7602
7611
  }
7603
7612
  });
7604
- var __defProp$1 = Object.defineProperty;
7613
+ var __defProp = Object.defineProperty;
7605
7614
  var __defProps = Object.defineProperties;
7606
7615
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7607
- var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
7608
- var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
7609
- var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
7610
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7611
- var __spreadValues$1 = (a, b) => {
7616
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7617
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7618
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7619
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7620
+ var __spreadValues = (a, b) => {
7612
7621
  for (var prop in b || (b = {}))
7613
- if (__hasOwnProp$1.call(b, prop))
7614
- __defNormalProp$1(a, prop, b[prop]);
7615
- if (__getOwnPropSymbols$1)
7616
- for (var prop of __getOwnPropSymbols$1(b)) {
7617
- if (__propIsEnum$1.call(b, prop))
7618
- __defNormalProp$1(a, prop, b[prop]);
7622
+ if (__hasOwnProp.call(b, prop))
7623
+ __defNormalProp(a, prop, b[prop]);
7624
+ if (__getOwnPropSymbols)
7625
+ for (var prop of __getOwnPropSymbols(b)) {
7626
+ if (__propIsEnum.call(b, prop))
7627
+ __defNormalProp(a, prop, b[prop]);
7619
7628
  }
7620
7629
  return a;
7621
7630
  };
@@ -7871,7 +7880,7 @@ var stdin_default$1n = vue.defineComponent({
7871
7880
  name: tab.title,
7872
7881
  disabled: tab.disabled
7873
7882
  }));
7874
- return actions.map((action, index) => __spreadProps(__spreadValues$1({}, action), {
7883
+ return actions.map((action, index) => __spreadProps(__spreadValues({}, action), {
7875
7884
  color: index === state.currentIndex ? "var(--van-primary-color)" : action.color,
7876
7885
  className: [action.className, bem$1d("more-option", {
7877
7886
  active: index === state.currentIndex
@@ -13025,21 +13034,25 @@ var stdin_default$K = vue.defineComponent({
13025
13034
  }
13026
13035
  });
13027
13036
  const InfoCard = withInstall(stdin_default$K);
13028
- var __defProp = Object.defineProperty;
13029
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
13030
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13031
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
13032
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13033
- var __spreadValues = (a, b) => {
13034
- for (var prop in b || (b = {}))
13035
- if (__hasOwnProp.call(b, prop))
13036
- __defNormalProp(a, prop, b[prop]);
13037
- if (__getOwnPropSymbols)
13038
- for (var prop of __getOwnPropSymbols(b)) {
13039
- if (__propIsEnum.call(b, prop))
13040
- __defNormalProp(a, prop, b[prop]);
13041
- }
13042
- return a;
13037
+ var __async$2 = (__this, __arguments, generator) => {
13038
+ return new Promise((resolve, reject) => {
13039
+ var fulfilled = (value) => {
13040
+ try {
13041
+ step(generator.next(value));
13042
+ } catch (e) {
13043
+ reject(e);
13044
+ }
13045
+ };
13046
+ var rejected = (value) => {
13047
+ try {
13048
+ step(generator.throw(value));
13049
+ } catch (e) {
13050
+ reject(e);
13051
+ }
13052
+ };
13053
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
13054
+ step((generator = generator.apply(__this, __arguments)).next());
13055
+ });
13043
13056
  };
13044
13057
  const [name$B, bem$B] = createNamespace("tree-select");
13045
13058
  const treeSelectProps = {
@@ -13051,20 +13064,31 @@ const treeSelectProps = {
13051
13064
  selectableParent: Boolean,
13052
13065
  showParentSelect: Boolean,
13053
13066
  showSelectLevels: Array,
13054
- showDivider: truthProp
13067
+ showDivider: truthProp,
13068
+ loadChildren: Function
13055
13069
  };
13056
13070
  var stdin_default$J = vue.defineComponent({
13057
13071
  name: name$B,
13058
13072
  props: treeSelectProps,
13059
- emits: ["update:modelValue", "update:expandedKeys", "select", "expand"],
13073
+ emits: ["update:modelValue", "update:expandedKeys", "select", "expand", "load", "load-error"],
13060
13074
  setup(props2, {
13061
13075
  emit,
13062
13076
  slots
13063
13077
  }) {
13064
13078
  const selectedKeys = vue.computed(() => props2.modelValue);
13065
13079
  const expandedKeys = vue.computed(() => props2.expandedKeys);
13080
+ const resolvedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
13081
+ const loadingKeys = vue.shallowReactive(/* @__PURE__ */ new Set());
13082
+ const loadedKeys = vue.shallowReactive(/* @__PURE__ */ new Set());
13066
13083
  const isExpanded = (id) => expandedKeys.value.includes(id);
13067
13084
  const isSelected = (id) => selectedKeys.value.includes(id);
13085
+ const isLoading = (id) => loadingKeys.has(id);
13086
+ const getChildren = (item) => {
13087
+ var _a;
13088
+ return ((_a = item.children) == null ? void 0 : _a.length) ? item.children : resolvedChildren.get(item.id) || item.children || [];
13089
+ };
13090
+ const isLoadable = (item) => !!props2.loadChildren && Array.isArray(item.children) && !item.children.length && !loadedKeys.has(item.id);
13091
+ const isBranch = (item) => !!getChildren(item).length || isLoadable(item) || isLoading(item.id);
13068
13092
  const isSelectionVisible = (hasChildren, level) => {
13069
13093
  var _a;
13070
13094
  const configuredVisibility = (_a = props2.showSelectLevels) == null ? void 0 : _a[level];
@@ -13076,10 +13100,7 @@ var stdin_default$J = vue.defineComponent({
13076
13100
  paddingLeft: `calc(var(--van-padding-md) + ${level * 16}px)`,
13077
13101
  "--van-tree-select-divider-left": `calc(var(--van-padding-md) + ${level * 16}px)`
13078
13102
  });
13079
- const getDescendantIds = (item) => {
13080
- var _a;
13081
- return ((_a = item.children) == null ? void 0 : _a.flatMap((child) => [child.id, ...getDescendantIds(child)])) || [];
13082
- };
13103
+ const getDescendantIds = (item) => getChildren(item).flatMap((child) => [child.id, ...getDescendantIds(child)]);
13083
13104
  const getSelectionState = (item) => {
13084
13105
  const descendantIds = getDescendantIds(item);
13085
13106
  if (!props2.cascade || !descendantIds.length) {
@@ -13094,11 +13115,11 @@ var stdin_default$J = vue.defineComponent({
13094
13115
  };
13095
13116
  const syncParentSelection = (items, values) => {
13096
13117
  items.forEach((item) => {
13097
- var _a;
13098
- if (!((_a = item.children) == null ? void 0 : _a.length))
13118
+ const children = getChildren(item);
13119
+ if (!children.length)
13099
13120
  return;
13100
- syncParentSelection(item.children, values);
13101
- const childIds = item.children.map((child) => child.id);
13121
+ syncParentSelection(children, values);
13122
+ const childIds = children.map((child) => child.id);
13102
13123
  const index = values.indexOf(item.id);
13103
13124
  const allChildrenSelected = childIds.every((id) => values.includes(id));
13104
13125
  if (allChildrenSelected && index === -1)
@@ -13107,13 +13128,45 @@ var stdin_default$J = vue.defineComponent({
13107
13128
  values.splice(index, 1);
13108
13129
  });
13109
13130
  };
13110
- const toggleExpanded = (id) => {
13131
+ const updateExpanded = (id, expanded) => {
13111
13132
  const next = expandedKeys.value.slice();
13112
13133
  const index = next.indexOf(id);
13113
- index === -1 ? next.push(id) : next.splice(index, 1);
13134
+ if (expanded && index === -1)
13135
+ next.push(id);
13136
+ if (!expanded && index !== -1)
13137
+ next.splice(index, 1);
13114
13138
  emit("update:expandedKeys", next);
13115
- emit("expand", id, index === -1);
13139
+ emit("expand", id, expanded);
13116
13140
  };
13141
+ const toggleExpanded = (item) => __async$2(this, null, function* () {
13142
+ const {
13143
+ id
13144
+ } = item;
13145
+ if (isLoading(id))
13146
+ return;
13147
+ if (isExpanded(id)) {
13148
+ updateExpanded(id, false);
13149
+ return;
13150
+ }
13151
+ if (isLoadable(item)) {
13152
+ loadingKeys.add(id);
13153
+ try {
13154
+ const result = yield props2.loadChildren(item);
13155
+ const children = Array.isArray(result) ? result : [];
13156
+ resolvedChildren.set(id, children);
13157
+ loadedKeys.add(id);
13158
+ emit("load", item, children);
13159
+ if (children.length)
13160
+ updateExpanded(id, true);
13161
+ } catch (error) {
13162
+ emit("load-error", item, error);
13163
+ } finally {
13164
+ loadingKeys.delete(id);
13165
+ }
13166
+ return;
13167
+ }
13168
+ updateExpanded(id, true);
13169
+ });
13117
13170
  const updateSelected = (item, selected) => {
13118
13171
  if (item.disabled || item.selectable === false)
13119
13172
  return;
@@ -13132,12 +13185,13 @@ var stdin_default$J = vue.defineComponent({
13132
13185
  emit("select", item, selected);
13133
13186
  };
13134
13187
  const renderNodes = (items, level = 0) => items.map((item) => {
13135
- var _a;
13136
- const hasChildren = !!((_a = item.children) == null ? void 0 : _a.length);
13188
+ const children = getChildren(item);
13189
+ const hasChildren = isBranch(item);
13137
13190
  const expanded = isExpanded(item.id);
13191
+ const loading = isLoading(item.id);
13138
13192
  const renderTitle = () => {
13139
- var _a2;
13140
- return ((_a2 = slots.title) == null ? void 0 : _a2.call(slots, {
13193
+ var _a;
13194
+ return ((_a = slots.title) == null ? void 0 : _a.call(slots, {
13141
13195
  item,
13142
13196
  level,
13143
13197
  hasChildren
@@ -13157,36 +13211,29 @@ var stdin_default$J = vue.defineComponent({
13157
13211
  }
13158
13212
  const selectable = item.selectable !== false && isSelectionVisible(hasChildren, level);
13159
13213
  const selectionState = getSelectionState(item);
13160
- return vue.createVNode("div", {
13161
- "key": item.id,
13162
- "class": bem$B("node")
13163
- }, [vue.createVNode(Cell, {
13164
- "class": bem$B("cell", {
13165
- branch: hasChildren
13166
- }),
13167
- "title": item.text,
13168
- "border": props2.showDivider,
13169
- "style": getNodeStyle(level),
13170
- "rightSelect": selectable && selectionState !== "indeterminate" ? selectionState === "checked" : void 0,
13171
- "selectType": props2.multiple ? "checkbox" : "radio",
13172
- "onUpdate:rightSelect": (value) => updateSelected(item, value)
13173
- }, __spreadValues({
13214
+ const cellSlots = {
13174
13215
  title: () => [hasChildren ? vue.createVNode("button", {
13175
13216
  "type": "button",
13176
13217
  "class": bem$B("expand-control"),
13177
13218
  "disabled": item.disabled,
13219
+ "aria-busy": loading,
13220
+ "aria-disabled": loading,
13178
13221
  "onClick": (event) => {
13179
13222
  event.stopPropagation();
13180
- toggleExpanded(item.id);
13223
+ toggleExpanded(item);
13181
13224
  }
13182
- }, [vue.createVNode(Icon, {
13225
+ }, [loading ? vue.createVNode(Loading, {
13226
+ "class": bem$B("loading"),
13227
+ "size": "var(--van-tree-select-arrow-size)"
13228
+ }, null) : vue.createVNode(Icon, {
13183
13229
  "name": "trangle-down",
13184
13230
  "class": bem$B("arrow", {
13185
13231
  expanded
13186
13232
  })
13187
13233
  }, null), vue.createVNode("span", null, [renderTitle()])]) : vue.createVNode("span", null, [renderTitle()])]
13188
- }, selectable && selectionState === "indeterminate" ? {
13189
- "right-select": () => vue.createVNode("button", {
13234
+ };
13235
+ if (selectable && selectionState === "indeterminate") {
13236
+ cellSlots["right-select"] = () => vue.createVNode("button", {
13190
13237
  "type": "button",
13191
13238
  "class": bem$B("indeterminate"),
13192
13239
  "aria-label": `部分选中${item.text}`,
@@ -13194,13 +13241,27 @@ var stdin_default$J = vue.defineComponent({
13194
13241
  event.stopPropagation();
13195
13242
  updateSelected(item, true);
13196
13243
  }
13197
- }, null)
13198
- } : {})), vue.createVNode(vue.Transition, {
13244
+ }, null);
13245
+ }
13246
+ return vue.createVNode("div", {
13247
+ "key": item.id,
13248
+ "class": bem$B("node")
13249
+ }, [vue.createVNode(Cell, {
13250
+ "class": bem$B("cell", {
13251
+ branch: hasChildren
13252
+ }),
13253
+ "title": item.text,
13254
+ "border": props2.showDivider,
13255
+ "style": getNodeStyle(level),
13256
+ "rightSelect": selectable && selectionState !== "indeterminate" ? selectionState === "checked" : void 0,
13257
+ "selectType": props2.multiple ? "checkbox" : "radio",
13258
+ "onUpdate:rightSelect": (value) => updateSelected(item, value)
13259
+ }, cellSlots), vue.createVNode(vue.Transition, {
13199
13260
  "name": "van-tree-select-expand"
13200
13261
  }, {
13201
13262
  default: () => [hasChildren && expanded && vue.createVNode("div", {
13202
13263
  "class": bem$B("children")
13203
- }, [renderNodes(item.children, level + 1)])]
13264
+ }, [renderNodes(children, level + 1)])]
13204
13265
  })]);
13205
13266
  });
13206
13267
  return () => vue.createVNode("div", {
@@ -15840,13 +15901,7 @@ const spaceItems = [{
15840
15901
  id: "high-voltage",
15841
15902
  text: "高压计量柜",
15842
15903
  selectable: false,
15843
- children: [{
15844
- id: "metering-cabinet-1",
15845
- text: "B3_高压计量柜_1#"
15846
- }, {
15847
- id: "metering-cabinet-2",
15848
- text: "B3_高压计量柜_2#"
15849
- }]
15904
+ children: []
15850
15905
  }]
15851
15906
  }, {
15852
15907
  id: "chiller-room",
@@ -16166,13 +16221,14 @@ const objectSelectProps = {
16166
16221
  specialties: {
16167
16222
  type: Array,
16168
16223
  default: () => specialties
16169
- }
16224
+ },
16225
+ loadChildren: Function
16170
16226
  };
16171
16227
  const flattenItems$1 = (items) => items.flatMap((item) => [item, ...item.children ? flattenItems$1(item.children) : []]);
16172
16228
  var stdin_default$t = vue.defineComponent({
16173
16229
  name: name$o,
16174
16230
  props: objectSelectProps,
16175
- emits: ["update:show", "update:modelValue", "change", "confirm"],
16231
+ emits: ["update:show", "update:modelValue", "change", "confirm", "load", "load-error"],
16176
16232
  setup(props2, {
16177
16233
  emit
16178
16234
  }) {
@@ -16185,6 +16241,14 @@ var stdin_default$t = vue.defineComponent({
16185
16241
  const expandedSelected = vue.ref(false);
16186
16242
  const searching = vue.ref(false);
16187
16243
  const keyword = vue.ref("");
16244
+ const loadedChildren = vue.shallowReactive(/* @__PURE__ */ new Map());
16245
+ const getChildren = (item) => loadedChildren.get(item.id) || item.children || [];
16246
+ const hydrateItems = (items) => items.map((item) => {
16247
+ const children = getChildren(item);
16248
+ return children.length ? extend({}, item, {
16249
+ children: hydrateItems(children)
16250
+ }) : item;
16251
+ });
16188
16252
  const currentSpecialtyItems = (specialty) => specialtyType.value === 0 ? specialty.deviceItems : specialty.systemItems;
16189
16253
  const expandOnlySpecialty = () => {
16190
16254
  if (props2.specialties.length === 1) {
@@ -16209,7 +16273,7 @@ var stdin_default$t = vue.defineComponent({
16209
16273
  immediate: true
16210
16274
  });
16211
16275
  const selected = vue.computed(() => props2.modelValue);
16212
- const allItems = vue.computed(() => flattenItems$1([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])]));
16276
+ const allItems = vue.computed(() => flattenItems$1(hydrateItems([...props2.spaceItems, ...props2.specialties.flatMap((specialty) => [...specialty.deviceItems, ...specialty.systemItems])])));
16213
16277
  const selectedItems = vue.computed(() => allItems.value.filter((item) => selected.value.includes(item.id)));
16214
16278
  const searchResults = vue.computed(() => {
16215
16279
  const query = keyword.value.trim().toLowerCase();
@@ -16254,19 +16318,29 @@ var stdin_default$t = vue.defineComponent({
16254
16318
  update([]);
16255
16319
  expandedSelected.value = false;
16256
16320
  };
16321
+ const onLoad = (item, children) => {
16322
+ loadedChildren.set(item.id, children);
16323
+ emit("load", item, children);
16324
+ };
16325
+ const onLoadError = (item, error) => {
16326
+ emit("load-error", item, error);
16327
+ };
16257
16328
  const renderTree = (items) => vue.createVNode("div", {
16258
16329
  "class": bem$o("tree-card")
16259
16330
  }, [vue.createVNode(TreeSelect, {
16260
16331
  "modelValue": selected.value,
16261
16332
  "expandedKeys": expandedKeys.value,
16262
- "items": items,
16333
+ "items": hydrateItems(items),
16263
16334
  "multiple": true,
16264
16335
  "showParentSelect": true,
16265
16336
  "cascade": false,
16337
+ "loadChildren": props2.loadChildren,
16266
16338
  "onUpdate:modelValue": update,
16267
16339
  "onUpdate:expandedKeys": (value) => {
16268
16340
  expandedKeys.value = value;
16269
- }
16341
+ },
16342
+ "onLoad": onLoad,
16343
+ "onLoad-error": onLoadError
16270
16344
  }, null)]);
16271
16345
  const renderSpecialty = (specialty) => {
16272
16346
  var _a;
@@ -19217,6 +19291,7 @@ const uploaderProps = {
19217
19291
  accept: makeStringProp("image/*"),
19218
19292
  capture: String,
19219
19293
  multiple: Boolean,
19294
+ sourcePicker: Boolean,
19220
19295
  label: String,
19221
19296
  required: Boolean,
19222
19297
  disabled: Boolean,
@@ -19246,21 +19321,26 @@ const uploaderProps = {
19246
19321
  var stdin_default$7 = vue.defineComponent({
19247
19322
  name: name$3,
19248
19323
  props: uploaderProps,
19249
- emits: ["delete", "oversize", "click-upload", "close-preview", "click-preview", "update:modelValue"],
19324
+ emits: ["delete", "oversize", "click-upload", "close-preview", "click-preview", "select-source", "update:modelValue"],
19250
19325
  setup(props2, {
19251
19326
  emit,
19252
19327
  slots
19253
19328
  }) {
19254
19329
  const inputRef = vue.ref();
19330
+ const cameraInputRef = vue.ref();
19331
+ const videoInputRef = vue.ref();
19332
+ const sourcePickerVisible = vue.ref(false);
19255
19333
  const urls = [];
19256
19334
  const getDetail = (index = props2.modelValue.length) => ({
19257
19335
  name: props2.name,
19258
19336
  index
19259
19337
  });
19260
19338
  const resetInput = () => {
19261
- if (inputRef.value) {
19262
- inputRef.value.value = "";
19263
- }
19339
+ [inputRef, cameraInputRef, videoInputRef].forEach((input) => {
19340
+ if (input.value) {
19341
+ input.value.value = "";
19342
+ }
19343
+ });
19264
19344
  };
19265
19345
  const onAfterRead = (items) => {
19266
19346
  resetInput();
@@ -19396,21 +19476,69 @@ var stdin_default$7 = vue.defineComponent({
19396
19476
  "class": bem$3("required")
19397
19477
  }, [vue.createTextVNode("*")]), props2.label]);
19398
19478
  };
19399
- const onClickUpload = (event) => emit("click-upload", event);
19479
+ const acceptTypes = () => props2.accept.split(",").map((type) => type.trim().toLowerCase()).filter(Boolean);
19480
+ const acceptsMediaType = (type) => acceptTypes().some((accept) => accept === `${type}/*` || accept.startsWith(`${type}/`));
19481
+ const triggerInput = (source) => {
19482
+ const target = source === "camera" ? cameraInputRef.value : source === "video" ? videoInputRef.value : inputRef.value;
19483
+ if (target && !props2.disabled && !props2.readonly) {
19484
+ emit("select-source", source);
19485
+ target.click();
19486
+ }
19487
+ };
19488
+ const onClickUpload = (event) => {
19489
+ emit("click-upload", event);
19490
+ if (props2.sourcePicker && !props2.disabled && !props2.readonly) {
19491
+ sourcePickerVisible.value = true;
19492
+ }
19493
+ };
19494
+ const renderInput = (input, accept, capture, multiple = false, hidden = false) => vue.createVNode("input", {
19495
+ "ref": input,
19496
+ "type": "file",
19497
+ "class": bem$3("input", {
19498
+ hidden
19499
+ }),
19500
+ "accept": accept,
19501
+ "capture": capture,
19502
+ "multiple": multiple,
19503
+ "disabled": props2.disabled,
19504
+ "onChange": onChange
19505
+ }, null);
19506
+ const renderSourcePicker = () => {
19507
+ if (!props2.sourcePicker)
19508
+ return;
19509
+ const actions = [];
19510
+ if (acceptsMediaType("image")) {
19511
+ actions.push({
19512
+ name: t("takePhoto"),
19513
+ callback: () => triggerInput("camera")
19514
+ });
19515
+ }
19516
+ if (acceptsMediaType("video")) {
19517
+ actions.push({
19518
+ name: t("recordVideo"),
19519
+ callback: () => triggerInput("video")
19520
+ });
19521
+ }
19522
+ actions.push({
19523
+ name: t("chooseFromAlbum"),
19524
+ callback: () => triggerInput("album")
19525
+ });
19526
+ return vue.createVNode(ActionSheet, {
19527
+ "show": sourcePickerVisible.value,
19528
+ "title": t("sourcePickerTitle"),
19529
+ "actions": actions,
19530
+ "contentAdaptive": true,
19531
+ "closeOnClickAction": true,
19532
+ "onUpdate:show": (show) => {
19533
+ sourcePickerVisible.value = show;
19534
+ }
19535
+ }, null);
19536
+ };
19400
19537
  const renderUpload = () => {
19401
19538
  if (props2.modelValue.length >= props2.maxCount || !props2.showUpload) {
19402
19539
  return;
19403
19540
  }
19404
- const Input = props2.readonly ? null : vue.createVNode("input", {
19405
- "ref": inputRef,
19406
- "type": "file",
19407
- "class": bem$3("input"),
19408
- "accept": props2.accept,
19409
- "capture": props2.capture,
19410
- "multiple": props2.multiple,
19411
- "disabled": props2.disabled,
19412
- "onChange": onChange
19413
- }, null);
19541
+ const Input = props2.readonly ? null : props2.sourcePicker ? [renderInput(inputRef, props2.accept, void 0, props2.multiple, true), acceptsMediaType("image") && renderInput(cameraInputRef, "image/*", props2.capture || "environment", false, true), acceptsMediaType("video") && renderInput(videoInputRef, "video/*", props2.capture || "environment", false, true)] : renderInput(inputRef, props2.accept, props2.capture, props2.multiple);
19414
19542
  if (slots.default) {
19415
19543
  return vue.createVNode("div", {
19416
19544
  "class": bem$3("input-wrapper"),
@@ -19430,8 +19558,14 @@ var stdin_default$7 = vue.defineComponent({
19430
19558
  "class": bem$3("upload-text")
19431
19559
  }, [props2.uploadText]), Input]);
19432
19560
  };
19433
- const chooseFile = () => {
19434
- if (inputRef.value && !props2.disabled) {
19561
+ const chooseFile = (source) => {
19562
+ if (props2.disabled || props2.readonly)
19563
+ return;
19564
+ if (source) {
19565
+ triggerInput(source);
19566
+ } else if (props2.sourcePicker) {
19567
+ sourcePickerVisible.value = true;
19568
+ } else if (inputRef.value) {
19435
19569
  inputRef.value.click();
19436
19570
  }
19437
19571
  };
@@ -19451,7 +19585,7 @@ var stdin_default$7 = vue.defineComponent({
19451
19585
  "class": bem$3("wrapper", {
19452
19586
  disabled: props2.disabled
19453
19587
  })
19454
- }, [props2.uploadFirst ? vue.createVNode(vue.Fragment, null, [renderUpload(), renderPreviewList()]) : vue.createVNode(vue.Fragment, null, [renderPreviewList(), renderUpload()])])]);
19588
+ }, [props2.uploadFirst ? vue.createVNode(vue.Fragment, null, [renderUpload(), renderPreviewList()]) : vue.createVNode(vue.Fragment, null, [renderPreviewList(), renderUpload()])]), renderSourcePicker()]);
19455
19589
  }
19456
19590
  });
19457
19591
  const Uploader = withInstall(stdin_default$7);
@@ -21331,7 +21465,7 @@ const Lazyload = {
21331
21465
  });
21332
21466
  }
21333
21467
  };
21334
- const version = "0.0.42";
21468
+ const version = "0.0.44";
21335
21469
  function install(app) {
21336
21470
  const components = [
21337
21471
  ActionBar,