sard 1.0.20 → 1.0.21

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.
package/index.js CHANGED
@@ -6,9 +6,9 @@ import { chooseFile, getFileName, imageDataToDataURL, isFileUrl, isImageFile, is
6
6
  import { isBoolean, isConfigObject, isDate, isEmptyArray, isFunction, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isString, isUndefined } from "./utils/is.js";
7
7
  import { addUnit, debounce, getPageRange, isEmptyBinding, isEmptyValue, isRenderVisible, isVisibleEmpty, noop, sleep, splitUnit, throttle } from "./utils/utils.js";
8
8
  import { ALPHANUMERIC_CHARS, ECLList, qrcode } from "./utils/qrcode.js";
9
- import { chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap } from "./utils/object.js";
9
+ import { assignDeep, chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap } from "./utils/object.js";
10
10
  import { arrayEqual, arrayMove, shuffle, spreadEach, toArray } from "./utils/array.js";
11
- import { addSeparator, camelCase, capitalize, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst } from "./utils/string.js";
11
+ import { addSeparator, camelCase, capitalize, interpolate, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst } from "./utils/string.js";
12
12
  import { getAspectFillSize, getAspectFitSize, getRotatedRect, getScrollIntoViewValue, getTouchPoint, getTransformOrigin, getTwoPointsDistance, isRectEqual, isSizeEqual, matchScrollVisible, scrollToTarget } from "./utils/geometry.js";
13
13
  import { getDampingValue, getInBoundValue, getOverflowRangeInArea, getRectDampingValue } from "./utils/physics.js";
14
14
  import { createInertialAnimate } from "./utils/inertialAnimate.js";
@@ -217,4 +217,4 @@ function prepareEnvironment() {
217
217
  });
218
218
  }
219
219
  //#endregion
220
- export { ADD_SWIPER_CONTEXT_KEY, ALPHANUMERIC_CHARS, Accordion, AccordionItem, ActionSheet, ActionSheetItem, Alert, Avatar, AvatarGroup, BackTop, Badge, Barcode, BarcodeFormatList, BarcodeTextPositionList, Button, Calendar, CalendarInput, CalendarPopout, CancelError, Card, Cascader, CascaderInput, CascaderPopout, Checkbox, CheckboxGroup, CheckboxInput, CheckboxPopout, Col, Collapse, ColorPicker, ColorPickerInput, ColorPickerPopout, Compact, CoolIcon, CountDown, CountTo, CropImage, DateStrip, DatetimePicker, DatetimePickerInput, DatetimePickerPopout, DatetimeRangePicker, DatetimeRangePickerInput, DatetimeRangePickerPopout, Descriptions, DescriptionsItem, Dialog, Divider, Dnd, DndHandle, DndItem, Dropdown, DropdownItem, ECLList, Ellipsis, Empty, Fab, FabItem, Flex, FloatingBubble, FloatingPanel, Form, FormItem, FormItemPlain, FormPlain, Friction, Grid, GridItem, Image, Indexes, IndexesAnchor, IndexesNav, Input, Keyboard, KeyboardPopout, List, ListItem, LoadMore, LoadMoreStatus, Loading, Marquee, Menu, MenuItem, Motion, Navbar, NavbarItem, NavbarPit, NoticeBar, Notify, OnlyChild, Overlay, Pagination, PasswordInput, Picker, PickerInput, PickerPopout, PickerView, PickerViewColumn, Popout, PopoutInput, Popover, Popup, PreviewImage, ProgressBar, ProgressCircle, PullDownRefresh, PuzzleVerify, Qrcode, REMOVE_SWIPER_CONTEXT_KEY, Radio, RadioGroup, RadioInput, RadioPopout, Rate, ReadMore, Result, RotateVerify, Row, SWIPER_AUTO_HEIGHT_KEY, ScrollList, ScrollSpy, ScrollSpyAnchor, Search, Segmented, SegmentedItem, Select, SelectInput, SelectOption, SelectOptionGroup, SelectPopout, ShareSheet, ShareSheetIcon, ShareSheetItem, ShareSheetRow, Sidebar, SidebarItem, Signature, Skeleton, SkeletonAvatar, SkeletonBlock, SkeletonParagraph, SkeletonTitle, SlideVerify, Slider, Spring, StatusBar, Step, Stepper, Steps, Sticky, StickyBox, SwipeAction, Swiper, SwiperItem, Switch, Tab, Tabbar, TabbarItem, TabbarPit, Table, Tabs, Tag, Text, Timeline, TimelineItem, Toast, Tree, TreeBranch, TreeNode, Upload, UploadPreview, Waterfall, WaterfallItem, WaterfallLoad, Watermark, actionSheet, addSeparator, addUnit, arrayEqual, arrayMove, autoUpdate, barcode, baseLunarYear, calculateBarcodeLayout, camelCase, capitalize, chainGet, chainSet, checkRtl, chooseFile, clamp, clipboard, computePosition, createActionSheet, createBem, createBemStruct, createCropImage, createDialog, createInertialAnimate, createNotify, createPreviewImage, createToast, cropImage, cssVar, cssVarName, currentLocale, debounce, deepClone, defaultBemConfig, defaultColorPickerPresets, defaultColorPickerValue, defaultOptionKeys, defineSetupFnComponent, dialog, earthlyBranches, enhanceComponent, extend, flatVNode, flexGap, formatColor, formatDate, formatNumber, formatTime, getAllImperatives, getAspectFillSize, getAspectFitSize, getAvailableImperative, getCurrentTime, getDampingValue, getDayOfYear, getDaysAfterLastDay, getDaysBeforeFirstDay, getDaysInMonth, getDaysSinceUnixEpoch, getDecimalsLength, getFileName, getFirstDayWeekday, getGridCenterSize, getGridIndex, getGridPrizeCount, getImperatives, getInBoundValue, getLeafNodes, getLunarDayName, getLunarHourName, getLunarLeapMonth, getLunarLeapMonthDays, getLunarMonthDays, getLunarMonthName, getLunarYearDays, getLunarYearName, getNextMonthDate, getNextMonthHeadDays, getNodeLevel, getOverflowRangeInArea, getPageRange, getPrevMonthDate, getPrevMonthTailDays, getPreviewColor, getRectDampingValue, getRotatedRect, getScrollIntoViewValue, getScrollTop, getTouchPoint, getTransformOrigin, getTreeCheckedKeys, getTreeHalfCheckedKeys, getTwoPointsDistance, heavenlyStems, hslToHsv, hslToHwb, hslToRgb, hsvToHsl, hwbToHsl, imageDataToDataURL, inRange, initializeCheckNodes, installer, isBoolean, isCancelError, isColorScheme, isConfigObject, isDate, isEmptyArray, isEmptyBinding, isEmptyValue, isFileUrl, isFunction, isImageFile, isImageUrl, isKorean, isLeapYear, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isRectEqual, isRenderVisible, isSizeEqual, isString, isUndefined, isVideoFile, isVideoUrl, isVisibleEmpty, kebabCase, loadImage, localeContextKey, logError, looseToNumber, lowerFirst, lunarDayNames, lunarInfo, lunarMonthNames, lunarToSolar, lunarYearNames, mapTreeToGrid, matchScrollVisible, measureTextWidth, minmaxDate, mround, nestedToMulti, noop, normalizeBarcodeOptions, normalizeHsla, normalizeHsva, notify, omit, omitFormPopoutProps, parseColor, parseDate, partition, partitionPopoutInputProps, pascalCase, pick, plateEnglishLetterKeys, plateProvinceKeys, plateSuffixKeys, popupManager, prepareEnvironment, previewImage, provideColorScheme, provideLocale, qrcode, random, reactiveComputed, readFileContent, rgbToHsl, round, safeAreaInsets, scrollToTarget, setCheckedRecursively, setLocale, shuffle, sleep, snakeCase, solarToLunar, splitUnit, spreadEach, springFestivals, throttle, toArray, toDate, toDateNumber, toDateString, toMonthNumber, toReactive, toTouchEvent, toast, treeToMap, uniqid, updateAncestorsChecked, upperFirst, useClickOutside, useColorScheme, useComposition, useCountDown, useDragPinch, useElementBackTop, useElementScroll, useFormContext, useFormItem, useFormItemContext, useFormPopout, useImperative, useInPopup, useIndeterminate, useInitialVelocity, useIntersectionObserver, useKeyList, useLocale, useLockScroll, useLuckyDraw, useLuckyGrid, useLuckyWheel, useMotioning, useOptionKeys, usePageBackTop, usePageScroll, usePointerDown, usePopoutInput, usePopper, usePopupEnter, usePopupVisibleHookProvide, useReachBottom, useResizeObserver, useRtl, useScrollSide, useScrollSpy, useScroller, useSimulatedClick, useSimulatedDblClick, useSimulatedPress, useSingleTask, useSlotMachine, useStopMovedClick, useTimeout, useTimeoutLoading, useTranslate, useTranslateWithPrefix, useWindowResize, useZIndex, walkAncestor, walkDescendant, walkNodes, windowInfo, withResolvers };
220
+ export { ADD_SWIPER_CONTEXT_KEY, ALPHANUMERIC_CHARS, Accordion, AccordionItem, ActionSheet, ActionSheetItem, Alert, Avatar, AvatarGroup, BackTop, Badge, Barcode, BarcodeFormatList, BarcodeTextPositionList, Button, Calendar, CalendarInput, CalendarPopout, CancelError, Card, Cascader, CascaderInput, CascaderPopout, Checkbox, CheckboxGroup, CheckboxInput, CheckboxPopout, Col, Collapse, ColorPicker, ColorPickerInput, ColorPickerPopout, Compact, CoolIcon, CountDown, CountTo, CropImage, DateStrip, DatetimePicker, DatetimePickerInput, DatetimePickerPopout, DatetimeRangePicker, DatetimeRangePickerInput, DatetimeRangePickerPopout, Descriptions, DescriptionsItem, Dialog, Divider, Dnd, DndHandle, DndItem, Dropdown, DropdownItem, ECLList, Ellipsis, Empty, Fab, FabItem, Flex, FloatingBubble, FloatingPanel, Form, FormItem, FormItemPlain, FormPlain, Friction, Grid, GridItem, Image, Indexes, IndexesAnchor, IndexesNav, Input, Keyboard, KeyboardPopout, List, ListItem, LoadMore, LoadMoreStatus, Loading, Marquee, Menu, MenuItem, Motion, Navbar, NavbarItem, NavbarPit, NoticeBar, Notify, OnlyChild, Overlay, Pagination, PasswordInput, Picker, PickerInput, PickerPopout, PickerView, PickerViewColumn, Popout, PopoutInput, Popover, Popup, PreviewImage, ProgressBar, ProgressCircle, PullDownRefresh, PuzzleVerify, Qrcode, REMOVE_SWIPER_CONTEXT_KEY, Radio, RadioGroup, RadioInput, RadioPopout, Rate, ReadMore, Result, RotateVerify, Row, SWIPER_AUTO_HEIGHT_KEY, ScrollList, ScrollSpy, ScrollSpyAnchor, Search, Segmented, SegmentedItem, Select, SelectInput, SelectOption, SelectOptionGroup, SelectPopout, ShareSheet, ShareSheetIcon, ShareSheetItem, ShareSheetRow, Sidebar, SidebarItem, Signature, Skeleton, SkeletonAvatar, SkeletonBlock, SkeletonParagraph, SkeletonTitle, SlideVerify, Slider, Spring, StatusBar, Step, Stepper, Steps, Sticky, StickyBox, SwipeAction, Swiper, SwiperItem, Switch, Tab, Tabbar, TabbarItem, TabbarPit, Table, Tabs, Tag, Text, Timeline, TimelineItem, Toast, Tree, TreeBranch, TreeNode, Upload, UploadPreview, Waterfall, WaterfallItem, WaterfallLoad, Watermark, actionSheet, addSeparator, addUnit, arrayEqual, arrayMove, assignDeep, autoUpdate, barcode, baseLunarYear, calculateBarcodeLayout, camelCase, capitalize, chainGet, chainSet, checkRtl, chooseFile, clamp, clipboard, computePosition, createActionSheet, createBem, createBemStruct, createCropImage, createDialog, createInertialAnimate, createNotify, createPreviewImage, createToast, cropImage, cssVar, cssVarName, currentLocale, debounce, deepClone, defaultBemConfig, defaultColorPickerPresets, defaultColorPickerValue, defaultOptionKeys, defineSetupFnComponent, dialog, earthlyBranches, enhanceComponent, extend, flatVNode, flexGap, formatColor, formatDate, formatNumber, formatTime, getAllImperatives, getAspectFillSize, getAspectFitSize, getAvailableImperative, getCurrentTime, getDampingValue, getDayOfYear, getDaysAfterLastDay, getDaysBeforeFirstDay, getDaysInMonth, getDaysSinceUnixEpoch, getDecimalsLength, getFileName, getFirstDayWeekday, getGridCenterSize, getGridIndex, getGridPrizeCount, getImperatives, getInBoundValue, getLeafNodes, getLunarDayName, getLunarHourName, getLunarLeapMonth, getLunarLeapMonthDays, getLunarMonthDays, getLunarMonthName, getLunarYearDays, getLunarYearName, getNextMonthDate, getNextMonthHeadDays, getNodeLevel, getOverflowRangeInArea, getPageRange, getPrevMonthDate, getPrevMonthTailDays, getPreviewColor, getRectDampingValue, getRotatedRect, getScrollIntoViewValue, getScrollTop, getTouchPoint, getTransformOrigin, getTreeCheckedKeys, getTreeHalfCheckedKeys, getTwoPointsDistance, heavenlyStems, hslToHsv, hslToHwb, hslToRgb, hsvToHsl, hwbToHsl, imageDataToDataURL, inRange, initializeCheckNodes, installer, interpolate, isBoolean, isCancelError, isColorScheme, isConfigObject, isDate, isEmptyArray, isEmptyBinding, isEmptyValue, isFileUrl, isFunction, isImageFile, isImageUrl, isKorean, isLeapYear, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isRectEqual, isRenderVisible, isSizeEqual, isString, isUndefined, isVideoFile, isVideoUrl, isVisibleEmpty, kebabCase, loadImage, localeContextKey, logError, looseToNumber, lowerFirst, lunarDayNames, lunarInfo, lunarMonthNames, lunarToSolar, lunarYearNames, mapTreeToGrid, matchScrollVisible, measureTextWidth, minmaxDate, mround, nestedToMulti, noop, normalizeBarcodeOptions, normalizeHsla, normalizeHsva, notify, omit, omitFormPopoutProps, parseColor, parseDate, partition, partitionPopoutInputProps, pascalCase, pick, plateEnglishLetterKeys, plateProvinceKeys, plateSuffixKeys, popupManager, prepareEnvironment, previewImage, provideColorScheme, provideLocale, qrcode, random, reactiveComputed, readFileContent, rgbToHsl, round, safeAreaInsets, scrollToTarget, setCheckedRecursively, setLocale, shuffle, sleep, snakeCase, solarToLunar, splitUnit, spreadEach, springFestivals, throttle, toArray, toDate, toDateNumber, toDateString, toMonthNumber, toReactive, toTouchEvent, toast, treeToMap, uniqid, updateAncestorsChecked, upperFirst, useClickOutside, useColorScheme, useComposition, useCountDown, useDragPinch, useElementBackTop, useElementScroll, useFormContext, useFormItem, useFormItemContext, useFormPopout, useImperative, useInPopup, useIndeterminate, useInitialVelocity, useIntersectionObserver, useKeyList, useLocale, useLockScroll, useLuckyDraw, useLuckyGrid, useLuckyWheel, useMotioning, useOptionKeys, usePageBackTop, usePageScroll, usePointerDown, usePopoutInput, usePopper, usePopupEnter, usePopupVisibleHookProvide, useReachBottom, useResizeObserver, useRtl, useScrollSide, useScrollSpy, useScroller, useSimulatedClick, useSimulatedDblClick, useSimulatedPress, useSingleTask, useSlotMachine, useStopMovedClick, useTimeout, useTimeoutLoading, useTranslate, useTranslateWithPrefix, useWindowResize, useZIndex, walkAncestor, walkDescendant, walkNodes, windowInfo, withResolvers };
package/locale/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { chainGet } from "../utils/object.js";
2
+ import { interpolate } from "../utils/string.js";
2
3
  import zh_CN_default from "./lang/zh-CN.js";
3
4
  import { computed, inject, ref, shallowRef, watch } from "vue";
4
5
  //#region packages/sard/locale/index.ts
@@ -11,13 +12,7 @@ function useTranslate(prefix = "") {
11
12
  const chain = typeof chainOrData === "string" ? prefix ? prefix + "." + chainOrData : chainOrData : prefix;
12
13
  data = chainOrData && typeof chainOrData === "object" ? chainOrData : data;
13
14
  const result = chainGet(locale.value, chain);
14
- if (typeof result === "string") {
15
- if (data) return result.replace(/\{([^}]*)\}/g, (match, p1) => {
16
- const value = data[p1];
17
- return value != null ? String(value) : match;
18
- });
19
- return result;
20
- }
15
+ if (typeof result === "string") return data ? interpolate(result, data) : result;
21
16
  return chain;
22
17
  };
23
18
  const select = (chain) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sard",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "sard 是基于 Vue3 的 Web 移动端 UI 组件库",
5
5
  "keywords": [
6
6
  "UI",
package/utils/index.js CHANGED
@@ -6,9 +6,9 @@ import { chooseFile, getFileName, imageDataToDataURL, isFileUrl, isImageFile, is
6
6
  import { isBoolean, isConfigObject, isDate, isEmptyArray, isFunction, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isString, isUndefined } from "./is.js";
7
7
  import { addUnit, debounce, getPageRange, isEmptyBinding, isEmptyValue, isRenderVisible, isVisibleEmpty, noop, sleep, splitUnit, throttle } from "./utils.js";
8
8
  import { ALPHANUMERIC_CHARS, ECLList, qrcode } from "./qrcode.js";
9
- import { chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap } from "./object.js";
9
+ import { assignDeep, chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap } from "./object.js";
10
10
  import { arrayEqual, arrayMove, shuffle, spreadEach, toArray } from "./array.js";
11
- import { addSeparator, camelCase, capitalize, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst } from "./string.js";
11
+ import { addSeparator, camelCase, capitalize, interpolate, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst } from "./string.js";
12
12
  import { getAspectFillSize, getAspectFitSize, getRotatedRect, getScrollIntoViewValue, getTouchPoint, getTransformOrigin, getTwoPointsDistance, isRectEqual, isSizeEqual, matchScrollVisible, scrollToTarget } from "./geometry.js";
13
13
  import { getDampingValue, getInBoundValue, getOverflowRangeInArea, getRectDampingValue } from "./physics.js";
14
14
  import { createInertialAnimate } from "./inertialAnimate.js";
@@ -24,4 +24,4 @@ import { Friction } from "./scroller/Friction.js";
24
24
  import { Spring } from "./scroller/Spring.js";
25
25
  import { withResolvers } from "./polyfill.js";
26
26
  import { useScroller } from "./scroller/useScroller.js";
27
- export { ALPHANUMERIC_CHARS, BarcodeFormatList, BarcodeTextPositionList, ECLList, Friction, OnlyChild, Spring, addSeparator, addUnit, arrayEqual, arrayMove, barcode, baseLunarYear, calculateBarcodeLayout, camelCase, capitalize, chainGet, chainSet, checkRtl, chooseFile, clamp, clipboard, createBem, createBemStruct, createInertialAnimate, cssVar, cssVarName, debounce, deepClone, defaultBemConfig, defaultColorPickerPresets, defaultColorPickerValue, defineSetupFnComponent, earthlyBranches, enhanceComponent, extend, flatVNode, formatColor, formatDate, formatNumber, getAspectFillSize, getAspectFitSize, getDampingValue, getDayOfYear, getDaysAfterLastDay, getDaysBeforeFirstDay, getDaysInMonth, getDaysSinceUnixEpoch, getDecimalsLength, getFileName, getFirstDayWeekday, getInBoundValue, getLeafNodes, getLunarDayName, getLunarHourName, getLunarLeapMonth, getLunarLeapMonthDays, getLunarMonthDays, getLunarMonthName, getLunarYearDays, getLunarYearName, getNextMonthDate, getNextMonthHeadDays, getNodeLevel, getOverflowRangeInArea, getPageRange, getPrevMonthDate, getPrevMonthTailDays, getPreviewColor, getRectDampingValue, getRotatedRect, getScrollIntoViewValue, getScrollTop, getTouchPoint, getTransformOrigin, getTreeCheckedKeys, getTreeHalfCheckedKeys, getTwoPointsDistance, heavenlyStems, hslToHsv, hslToHwb, hslToRgb, hsvToHsl, hwbToHsl, imageDataToDataURL, inRange, initializeCheckNodes, isBoolean, isConfigObject, isDate, isEmptyArray, isEmptyBinding, isEmptyValue, isFileUrl, isFunction, isImageFile, isImageUrl, isKorean, isLeapYear, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isRectEqual, isRenderVisible, isSizeEqual, isString, isUndefined, isVideoFile, isVideoUrl, isVisibleEmpty, kebabCase, loadImage, logError, looseToNumber, lowerFirst, lunarDayNames, lunarInfo, lunarMonthNames, lunarToSolar, lunarYearNames, mapTreeToGrid, matchScrollVisible, measureTextWidth, minmaxDate, mround, nestedToMulti, noop, normalizeBarcodeOptions, normalizeHsla, normalizeHsva, omit, parseColor, parseDate, partition, pascalCase, pick, qrcode, random, readFileContent, rgbToHsl, round, scrollToTarget, setCheckedRecursively, shuffle, sleep, snakeCase, solarToLunar, splitUnit, spreadEach, springFestivals, throttle, toArray, toDate, toDateNumber, toDateString, toMonthNumber, toTouchEvent, treeToMap, uniqid, updateAncestorsChecked, upperFirst, useScroller, walkAncestor, walkDescendant, walkNodes, withResolvers };
27
+ export { ALPHANUMERIC_CHARS, BarcodeFormatList, BarcodeTextPositionList, ECLList, Friction, OnlyChild, Spring, addSeparator, addUnit, arrayEqual, arrayMove, assignDeep, barcode, baseLunarYear, calculateBarcodeLayout, camelCase, capitalize, chainGet, chainSet, checkRtl, chooseFile, clamp, clipboard, createBem, createBemStruct, createInertialAnimate, cssVar, cssVarName, debounce, deepClone, defaultBemConfig, defaultColorPickerPresets, defaultColorPickerValue, defineSetupFnComponent, earthlyBranches, enhanceComponent, extend, flatVNode, formatColor, formatDate, formatNumber, getAspectFillSize, getAspectFitSize, getDampingValue, getDayOfYear, getDaysAfterLastDay, getDaysBeforeFirstDay, getDaysInMonth, getDaysSinceUnixEpoch, getDecimalsLength, getFileName, getFirstDayWeekday, getInBoundValue, getLeafNodes, getLunarDayName, getLunarHourName, getLunarLeapMonth, getLunarLeapMonthDays, getLunarMonthDays, getLunarMonthName, getLunarYearDays, getLunarYearName, getNextMonthDate, getNextMonthHeadDays, getNodeLevel, getOverflowRangeInArea, getPageRange, getPrevMonthDate, getPrevMonthTailDays, getPreviewColor, getRectDampingValue, getRotatedRect, getScrollIntoViewValue, getScrollTop, getTouchPoint, getTransformOrigin, getTreeCheckedKeys, getTreeHalfCheckedKeys, getTwoPointsDistance, heavenlyStems, hslToHsv, hslToHwb, hslToRgb, hsvToHsl, hwbToHsl, imageDataToDataURL, inRange, initializeCheckNodes, interpolate, isBoolean, isConfigObject, isDate, isEmptyArray, isEmptyBinding, isEmptyValue, isFileUrl, isFunction, isImageFile, isImageUrl, isKorean, isLeapYear, isNoEmptyArray, isNullish, isNumber, isObject, isPlainObject, isPrimitive, isRectEqual, isRenderVisible, isSizeEqual, isString, isUndefined, isVideoFile, isVideoUrl, isVisibleEmpty, kebabCase, loadImage, logError, looseToNumber, lowerFirst, lunarDayNames, lunarInfo, lunarMonthNames, lunarToSolar, lunarYearNames, mapTreeToGrid, matchScrollVisible, measureTextWidth, minmaxDate, mround, nestedToMulti, noop, normalizeBarcodeOptions, normalizeHsla, normalizeHsva, omit, parseColor, parseDate, partition, pascalCase, pick, qrcode, random, readFileContent, rgbToHsl, round, scrollToTarget, setCheckedRecursively, shuffle, sleep, snakeCase, solarToLunar, splitUnit, spreadEach, springFestivals, throttle, toArray, toDate, toDateNumber, toDateString, toMonthNumber, toTouchEvent, treeToMap, uniqid, updateAncestorsChecked, upperFirst, useScroller, walkAncestor, walkDescendant, walkNodes, withResolvers };
package/utils/object.d.ts CHANGED
@@ -23,6 +23,11 @@ export declare function deepClone(target: any): any;
23
23
  * 深拷贝其他对象到第一个对象
24
24
  */
25
25
  export declare function extend(...args: any[]): any;
26
+ /**
27
+ * 深度合并多个对象并返回新对象:纯对象会递归合并,数组等其他非纯对象会被整体覆盖。
28
+ * 与 `extend` 不同,不会修改传入的任何对象。
29
+ */
30
+ export declare function assignDeep(...objects: Record<string, any>[]): Record<string, any>;
26
31
  export declare function treeToMap(tree: AnyObject[], keyName: string, childrenName: string, parentName: string): {
27
32
  [p: string]: AnyObject;
28
33
  };
package/utils/object.js CHANGED
@@ -71,6 +71,25 @@ function extend(...args) {
71
71
  }
72
72
  return target;
73
73
  }
74
+ /**
75
+ * 深度合并多个对象并返回新对象:纯对象会递归合并,数组等其他非纯对象会被整体覆盖。
76
+ * 与 `extend` 不同,不会修改传入的任何对象。
77
+ */
78
+ function assignDeep(...objects) {
79
+ const result = {};
80
+ for (const object of objects) {
81
+ if (object == null) continue;
82
+ Object.keys(object).forEach((key) => {
83
+ const value = object[key];
84
+ if (value === void 0) return;
85
+ if (isPlainObject(value)) {
86
+ const prev = result[key];
87
+ result[key] = assignDeep(isPlainObject(prev) ? prev : {}, value);
88
+ } else result[key] = value;
89
+ });
90
+ }
91
+ return result;
92
+ }
74
93
  function treeToMap(tree, keyName, childrenName, parentName) {
75
94
  const map = {};
76
95
  function recurse(children, parent) {
@@ -131,4 +150,4 @@ function nestedToMulti(nested, values, { getValue, getChildren }) {
131
150
  return columns;
132
151
  }
133
152
  //#endregion
134
- export { chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap };
153
+ export { assignDeep, chainGet, chainSet, deepClone, extend, nestedToMulti, omit, partition, pick, treeToMap };
package/utils/string.d.ts CHANGED
@@ -35,3 +35,9 @@ export declare function uniqid(): string;
35
35
  * 判断是否为韩文字符
36
36
  */
37
37
  export declare function isKorean(text: string): boolean;
38
+ /**
39
+ * 使用 `{key}` 占位符替换模板内容:
40
+ * `data` 为对象时按名匹配(`{name}`),为数组时按下标匹配(`{0}`)。
41
+ * 对应值为 `null`/`undefined` 或不存在时保留占位符原样;不传 `data` 时原样返回。
42
+ */
43
+ export declare function interpolate(template: string, data?: Record<string, any> | any[]): string;
package/utils/string.js CHANGED
@@ -64,5 +64,17 @@ function uniqid() {
64
64
  function isKorean(text) {
65
65
  return /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
66
66
  }
67
+ /**
68
+ * 使用 `{key}` 占位符替换模板内容:
69
+ * `data` 为对象时按名匹配(`{name}`),为数组时按下标匹配(`{0}`)。
70
+ * 对应值为 `null`/`undefined` 或不存在时保留占位符原样;不传 `data` 时原样返回。
71
+ */
72
+ function interpolate(template, data) {
73
+ if (data == null) return template;
74
+ return template.replace(/\{([^}]*)\}/g, (match, key) => {
75
+ const value = Array.isArray(data) ? data[Number(key)] : data[key];
76
+ return value != null ? String(value) : match;
77
+ });
78
+ }
67
79
  //#endregion
68
- export { addSeparator, camelCase, capitalize, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst };
80
+ export { addSeparator, camelCase, capitalize, interpolate, isKorean, kebabCase, lowerFirst, pascalCase, snakeCase, uniqid, upperFirst };