diff --git a/pages.json b/pages.json
index a9290f3..f8b6a3c 100644
--- a/pages.json
+++ b/pages.json
@@ -176,6 +176,15 @@
// "navigationBarTextStyle": "white"
}
},
+ {
+ "path": "pages/views/shengchan/ribaoshuju/rbsjLsxq",
+ "style": {
+ // "navigationStyle": "custom"
+ "navigationBarTitleText": "历史详情",
+ "enablePullDownRefresh": false,
+ "navigationBarTextStyle": "white"
+ }
+ },
{
"path": "pages/userlist/index",
"style": {
diff --git a/pages/product/NatrueGas/index.vue b/pages/product/NatrueGas/index.vue
deleted file mode 100644
index c3d2a27..0000000
--- a/pages/product/NatrueGas/index.vue
+++ /dev/null
@@ -1,444 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- {{ item.gas }}
-
- 当日量:
- {{ item.dailyVolume }}
- 年累计:
- {{ item.yearVolume }}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pages/product/index.vue b/pages/product/index.vue
deleted file mode 100644
index 2526a18..0000000
--- a/pages/product/index.vue
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
- 生产经营数据
-
-
-
-
-
-
-
-
diff --git a/pages/views/renliziyuan/renyuanxinxi/tongji.vue b/pages/views/renliziyuan/renyuanxinxi/tongji.vue
index d16d0d2..5b20670 100644
--- a/pages/views/renliziyuan/renyuanxinxi/tongji.vue
+++ b/pages/views/renliziyuan/renyuanxinxi/tongji.vue
@@ -6,8 +6,7 @@
-
+
@@ -72,7 +71,7 @@
- 详情
+ 详情
@@ -83,295 +82,290 @@
\ No newline at end of file
+/* 内容样式 */
+.dataStyle {
+ max-font-size: 14px;
+ /* 最大字体限制 */
+ min-font-size: 10px;
+ /* 最小字体限制 */
+ font-size: 12px;
+ color: #00007f;
+ line-height: 30px;
+ height: 30px;
+ font-weight: 500;
+ text-align: center;
+ vertical-align: middle;
+ border-bottom: 1px solid #919191;
+ border-left: 1px solid #919191;
+ text-overflow: ellipsis;
+}
+
diff --git a/pages/views/shengchan/index.vue b/pages/views/shengchan/index.vue
index 16a5d57..6b2fbd9 100644
--- a/pages/views/shengchan/index.vue
+++ b/pages/views/shengchan/index.vue
@@ -1,52 +1,61 @@
-
- 生产经营数据
+
+
+
+
+
+
\ No newline at end of file
+.placeholder {
+ height: v-bind(cusnavbarheight);
+}
+
diff --git a/pages/views/shengchan/ribaoshuju/rbsjLsxq.vue b/pages/views/shengchan/ribaoshuju/rbsjLsxq.vue
new file mode 100644
index 0000000..2946695
--- /dev/null
+++ b/pages/views/shengchan/ribaoshuju/rbsjLsxq.vue
@@ -0,0 +1,315 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 最大值: {{ dataStats.max }}
+ 最小值: {{ dataStats.min }}
+ 平均值: {{ dataStats.average }}
+
+
+
+
+
+
+
+
+ {{ index + 1 }}
+ {{ item.unit }}
+ {{ item.rqDate }}
+
+ {{ item.rq }}
+
+
+
+
+ 暂无相关数据
+
+
+
+
+
+
+
+
+
diff --git a/pages/views/shengchan/ribaoshuju/trqRbsj.vue b/pages/views/shengchan/ribaoshuju/trqRbsj.vue
index 345c1e9..776e73b 100644
--- a/pages/views/shengchan/ribaoshuju/trqRbsj.vue
+++ b/pages/views/shengchan/ribaoshuju/trqRbsj.vue
@@ -1,6 +1,10 @@
-
+
+
+
+
+ 全年时间进度:{{ timePercent }}%
@@ -14,6 +18,12 @@
年累计
{{ item.yearVolume || '-' }}
+
+
+
+
+ {{ item.yearPerCent }}%
+
@@ -25,424 +35,476 @@
-
-
-
-
-
+
+
+
+
-
- {{ index }}
+
+ {{ index + 1 }}
{{ item.unit }}
{{ formatNumber(item.rq) }}
-
- {{ formatNumber(item.totalGas) }}
{{ formatNumber(item.yearVolume) }}
+ 历史
-
- 暂无相关数据
-
-
-
+ 暂无相关数据
+
+
-
\ No newline at end of file
+.progress-text {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ color: red; /* 保持红色 */
+ font-size: 12px;
+ font-weight: bold;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* 提升可读性 */
+}
+
diff --git a/pages/views/shengchan/ribaoshuju/yyRbsj.vue b/pages/views/shengchan/ribaoshuju/yyRbsj.vue
index eea775c..7a832df 100644
--- a/pages/views/shengchan/ribaoshuju/yyRbsj.vue
+++ b/pages/views/shengchan/ribaoshuju/yyRbsj.vue
@@ -18,6 +18,19 @@
年累计
{{ item.nl || '-' }}
+
+
+
+
+
+ {{ item.yearPerCent }}%
+
@@ -33,17 +46,17 @@
-
- {{ index }}
+
+ {{ index }}
{{ item.dw }}
{{ formatNumber(item.rcwy) }}
@@ -52,275 +65,305 @@
{{ formatNumber(item.nl) }}
+ 历史
-
- 暂无相关数据
-
+ 暂无相关数据
-
\ No newline at end of file
+}
+.progress-item {
+ margin-bottom: 20px;
+}
+
+.progress-bar {
+ position: relative;
+ height: 20px;
+ background: #f0f0f0;
+ border-radius: 10px;
+ overflow: hidden;
+}
+
+.progress {
+ height: 100%;
+ transition: all 0.3s;
+}
+
+.progress-text {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ color: red; /* 保持红色 */
+ font-size: 12px;
+ font-weight: bold;
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* 提升可读性 */
+}
+
diff --git a/uni_modules/cxc-szcx-dateRangeSelect/changelog.md b/uni_modules/cxc-szcx-dateRangeSelect/changelog.md
new file mode 100644
index 0000000..e69de29
diff --git a/uni_modules/cxc-szcx-dateRangeSelect/components/cxc-szcx-dateRangeSelect/cxc-szcx-dateRangeSelect.vue b/uni_modules/cxc-szcx-dateRangeSelect/components/cxc-szcx-dateRangeSelect/cxc-szcx-dateRangeSelect.vue
new file mode 100644
index 0000000..555df13
--- /dev/null
+++ b/uni_modules/cxc-szcx-dateRangeSelect/components/cxc-szcx-dateRangeSelect/cxc-szcx-dateRangeSelect.vue
@@ -0,0 +1,101 @@
+
+
+
+
+
+ {{ dateRange[0] || '开始日期' }}
+
+ 至
+
+ {{ dateRange[1] || '结束日期' }}
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/cxc-szcx-dateRangeSelect/package.json b/uni_modules/cxc-szcx-dateRangeSelect/package.json
new file mode 100644
index 0000000..727d7ea
--- /dev/null
+++ b/uni_modules/cxc-szcx-dateRangeSelect/package.json
@@ -0,0 +1,83 @@
+{
+ "id": "cxc-szcx-dateRangeSelect",
+ "displayName": "cxc-szcx-dateRangeSelect",
+ "version": "1.0.0",
+ "description": "cxc-szcx-dateRangeSelect",
+ "keywords": [
+ "cxc-szcx-dateRangeSelect"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.1.0"
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "",
+ "data": "",
+ "permissions": ""
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "u",
+ "aliyun": "u",
+ "alipay": "u"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "u",
+ "vue3": "u"
+ },
+ "App": {
+ "app-vue": "u",
+ "app-nvue": "u",
+ "app-uvue": "u"
+ },
+ "H5-mobile": {
+ "Safari": "u",
+ "Android Browser": "u",
+ "微信浏览器(Android)": "u",
+ "QQ浏览器(Android)": "u"
+ },
+ "H5-pc": {
+ "Chrome": "u",
+ "IE": "u",
+ "Edge": "u",
+ "Firefox": "u",
+ "Safari": "u"
+ },
+ "小程序": {
+ "微信": "u",
+ "阿里": "u",
+ "百度": "u",
+ "字节跳动": "u",
+ "QQ": "u",
+ "钉钉": "u",
+ "快手": "u",
+ "飞书": "u",
+ "京东": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/cxc-szcx-dateRangeSelect/readme.md b/uni_modules/cxc-szcx-dateRangeSelect/readme.md
new file mode 100644
index 0000000..a96c0b4
--- /dev/null
+++ b/uni_modules/cxc-szcx-dateRangeSelect/readme.md
@@ -0,0 +1,139 @@
+# cxc-szcx-dateRangeSelect
+# # 紧凑型日期时间选择器组件说明书
+
+## 一、组件概述
+`compact-datetime-picker` 是一个基于 Vue 开发的紧凑型日期时间选择器组件,用于在页面中选择日期范围。组件提供了自然周期和相对周期两种选择模式,并且支持快捷选择本周、本月、本季、本年、近一周、近一月、近一季、近一年等常见时间范围。
+
+## 二、组件依赖
+- **Vue**:组件基于 Vue 框架开发。
+- **uni-popup**:来自 `uni-app` 的弹窗组件,用于显示日期选择器的弹出层。
+
+## 三、组件使用方法
+
+### 1. 引入组件
+在需要使用该组件的 Vue 文件中,引入 `compact-datetime-picker` 组件。
+```vue
+
+
+
+
+
+
+
+```
+
+### 2. 组件属性
+| 属性名 | 类型 | 默认值 | 描述 |
+| ---- | ---- | ---- | ---- |
+| `modelValue` | `Array` | `[null, null]` | 双向绑定的日期范围数组,第一个元素为开始日期,第二个元素为结束日期。 |
+
+## 四、组件内部实现
+
+### 1. 模板部分
+- **输入框区域**:显示开始日期和结束日期的输入框,点击输入框可打开日期选择弹窗。
+- **日期选择弹窗**:
+ - **快捷按钮区域**:包含自然周期和相对周期的切换按钮,以及不同模式下的快捷操作按钮。
+ - **日历选择区域**:显示当前月份的日历,可选择日期。
+ - **操作按钮**:包含取消和确定按钮,用于关闭弹窗和确认选择的日期范围。
+
+### 2. 脚本部分
+
+#### 2.1 数据属性
+```javascript
+data() {
+ return {
+ isNatural: true, // 是否为自然周期模式
+ activeType: 'start', // 当前活跃的日期选择类型(开始或结束)
+ currentMonth: new Date(), // 当前显示的月份
+ tempStart: null, // 临时开始日期
+ tempEnd: null, // 临时结束日期
+ weekDays: ['日', '一', '二', '三', '四', '五', '六'], // 星期几的显示文本
+ quickButtonszr: [
+ { label: '本周', type: 'week' },
+ { label: '本月', type: 'month' },
+ { label: '本季', type: 'quarter' },
+ { label: '本年', type: 'year' }
+ ], // 自然周期模式下的快捷按钮
+ quickButtonsxd: [
+ { label: '近一周', type: 'week' },
+ { label: '近一月', type: 'month' },
+ { label: '近一季', type: 'quarter' },
+ { label: '近一年', type: 'year' }
+ ] // 相对周期模式下的快捷按钮
+ };
+}
+```
+
+#### 2.2 计算属性
+- `formattedStart`:格式化后的开始日期。
+- `formattedEnd`:格式化后的结束日期。
+- `calendarDays`:生成当前月份的日历数据。
+- `monthText`:当前月份的显示文本。
+
+#### 2.3 监听属性
+```javascript
+watch: {
+ modelValue: {
+ immediate: true,
+ handler(newVal) {
+ this.tempStart = newVal[0];
+ this.tempEnd = newVal[1];
+ }
+ }
+}
+```
+监听 `modelValue` 的变化,初始化临时日期。
+
+#### 2.4 方法
+- **打开弹窗并初始化临时值**:`openPicker(type)`,打开日期选择弹窗,并根据活跃类型初始化临时日期。
+- **日期点击处理**:`handleDayClick(day)`,处理日期点击事件,更新临时开始或结束日期。
+- **确认选择**:`confirmSelection()`,确认选择的日期范围,触发 `update:modelValue` 事件并关闭弹窗。
+- **关闭弹窗**:`closePicker()`,关闭日期选择弹窗,并重置临时日期。
+- **重置临时日期**:`resetTempDates()`,将临时日期重置为当前的 `modelValue`。
+- **生成日历数据**:`generateCalendar(date)`,根据给定的月份生成日历数据。
+- **日期选择处理**:`selectDate(date)`,处理日期选择,更新 `modelValue`。
+- **切换月份**:`changeMonth(offset)`,切换当前显示的月份。
+- **判断日期状态**:
+ - `isSelected(date)`:判断日期是否被选中。
+ - `isEnd(date)`:判断日期是否为结束日期。
+ - `isToday(date)`:判断日期是否为今天。
+ - `isStart(date)`:判断日期是否为开始日期。
+ - `isInRange(date)`:判断日期是否在选择的范围内。
+ - `isSameDay(d1, d2)`:判断两个日期是否为同一天。
+- **快捷范围设置**:`setQuickRange(type)`,根据快捷按钮的类型设置日期范围,并关闭弹窗。
+- **自然周期计算**:`calcNaturalRange(type, currentDate)`,计算自然周期模式下的日期范围。
+- **相对周期计算**:`calcRelativeRange(type, currentDate)`,计算相对周期模式下的日期范围。
+- **周计算(周一为起点)**:
+ - `getWeekStart(date)`:获取一周的开始日期。
+ - `getWeekEnd(startDate)`:获取一周的结束日期。
+- **月末处理**:`lastDayOfMonth(date)`,获取给定月份的最后一天。
+- **月末日调整**:`adjustMonthEnd(start, end)`,调整开始日期到合适的月末日期。
+- **闰年判断**:`isLeapYear(year)`,判断给定年份是否为闰年。
+- **模式切换**:`toggleMode(isNatural)`,切换自然周期和相对周期模式。
+- **日期格式化**:`formatDate(date)`,将日期格式化为 `YYYY-MM-DD` 的字符串。
+
+### 3. 样式部分
+- **输入框区域**:设置输入框的样式,包括边框、背景色、字体大小等。
+- **紧凑弹窗**:设置弹窗的整体样式,包括背景色、边框半径等。
+- **紧凑头部**:设置月份标题和导航箭头的样式。
+- **紧凑日期网格**:设置星期几和日期的显示样式,以及不同状态下的日期背景色和字体颜色。
+- **快捷按钮区域**:设置模式切换按钮和快捷操作按钮的样式。
+- **底部操作**:设置取消和确定按钮的样式。
+
+## 五、注意事项
+- 组件使用了 `uni-popup` 组件,确保项目中已正确引入和配置。
+- 日期范围的选择逻辑较为复杂,特别是在自然周期和相对周期的切换以及快捷范围设置时,需注意日期的计算和显示。
+- 组件的样式是基于 `scoped` 作用域的,可根据项目需求进行调整和扩展。
\ No newline at end of file
diff --git a/uni_modules/cxc-szcx-lineChart/changelog.md b/uni_modules/cxc-szcx-lineChart/changelog.md
new file mode 100644
index 0000000..e69de29
diff --git a/uni_modules/cxc-szcx-lineChart/components/cxc-szcx-lineChart/cxc-szcx-lineChart.vue b/uni_modules/cxc-szcx-lineChart/components/cxc-szcx-lineChart/cxc-szcx-lineChart.vue
new file mode 100644
index 0000000..a3268aa
--- /dev/null
+++ b/uni_modules/cxc-szcx-lineChart/components/cxc-szcx-lineChart/cxc-szcx-lineChart.vue
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/cxc-szcx-lineChart/package.json b/uni_modules/cxc-szcx-lineChart/package.json
new file mode 100644
index 0000000..dd31225
--- /dev/null
+++ b/uni_modules/cxc-szcx-lineChart/package.json
@@ -0,0 +1,83 @@
+{
+ "id": "cxc-szcx-lineChart",
+ "displayName": "cxc-szcx-lineChart",
+ "version": "1.0.0",
+ "description": "cxc-szcx-lineChart",
+ "keywords": [
+ "cxc-szcx-lineChart"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.1.0"
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "",
+ "data": "",
+ "permissions": ""
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "u",
+ "aliyun": "u",
+ "alipay": "u"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "u",
+ "vue3": "u"
+ },
+ "App": {
+ "app-vue": "u",
+ "app-nvue": "u",
+ "app-uvue": "u"
+ },
+ "H5-mobile": {
+ "Safari": "u",
+ "Android Browser": "u",
+ "微信浏览器(Android)": "u",
+ "QQ浏览器(Android)": "u"
+ },
+ "H5-pc": {
+ "Chrome": "u",
+ "IE": "u",
+ "Edge": "u",
+ "Firefox": "u",
+ "Safari": "u"
+ },
+ "小程序": {
+ "微信": "u",
+ "阿里": "u",
+ "百度": "u",
+ "字节跳动": "u",
+ "QQ": "u",
+ "钉钉": "u",
+ "快手": "u",
+ "飞书": "u",
+ "京东": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/cxc-szcx-lineChart/readme.md b/uni_modules/cxc-szcx-lineChart/readme.md
new file mode 100644
index 0000000..9ea8aef
--- /dev/null
+++ b/uni_modules/cxc-szcx-lineChart/readme.md
@@ -0,0 +1,179 @@
+# cxc-szcx-lineChart
+# # `line-chart.vue` 组件说明书
+
+## 一、组件概述
+`line-chart.vue` 是一个基于 ECharts 实现的折线图组件,用于在 UniApp 项目中展示数据的折线图。该组件接收一系列数据和配置参数,支持动态更新数据,并展示参考线。
+
+## 二、组件依赖
+- **Vue 3**:使用 Vue 3 的组合式 API 进行开发。
+- **ECharts**:用于绘制折线图。
+- **`lime-echart`**:UniApp 插件,提供 ECharts 的渲染支持。
+
+## 三、组件使用方法
+
+### 1. 引入组件
+在需要使用该组件的页面中引入 `line-chart.vue` 组件。
+```vue
+
+
+
+
+
+
+
+```
+
+### 2. 组件属性
+
+| 属性名 | 类型 | 默认值 | 描述 |
+| ---- | ---- | ---- | ---- |
+| `dataList` | `Object` | `[]` | 包含图表数据的数组,每个元素是一个对象,包含 `xField`、`yField` 和 `legendField` 对应的数据。 |
+| `xField` | `String` | `''` | 数据中用于表示 x 轴的字段名。 |
+| `yField` | `String` | `''` | 数据中用于表示 y 轴的字段名。 |
+| `legendField` | `String` | `''` | 数据中用于表示图例的字段名。 |
+| `referenceValue` | `Number` | `10` | 图表中参考线的数值。 |
+
+## 四、组件内部实现
+
+### 1. 模板部分
+```vue
+
+
+
+
+
+```
+- 使用 `l-echart` 组件渲染图表,通过 `ref` 绑定到 `chart`,并在初始化完成时调用 `initChart` 方法。
+
+### 2. 脚本部分
+
+#### 2.1 引入必要的模块
+```javascript
+import { ref, watch } from 'vue';
+```
+引入 Vue 3 的 `ref` 和 `watch` 函数。
+
+#### 2.2 定义组件属性
+```javascript
+const props = defineProps({
+ dataList: {
+ type: Object,
+ default: () => []
+ },
+ // 其他属性...
+});
+```
+定义组件接收的属性。
+
+#### 2.3 初始化图表
+```javascript
+const chart = ref(null);
+let echarts = null;
+
+const initChart = async (canvas) => {
+ await initEcharts(canvas);
+ updateChart();
+};
+
+const initEcharts = async (canvas) => {
+ echarts = await import('echarts');
+ const { init } = await import('@/uni_modules/lime-echart/static/echarts.min');
+ echarts = init(canvas, echarts);
+};
+```
+- `chart` 用于引用 `l-echart` 组件。
+- `initChart` 方法在图表初始化时调用,先初始化 ECharts 实例,再更新图表。
+- `initEcharts` 方法异步加载 ECharts 并初始化实例。
+
+#### 2.4 处理数据
+```javascript
+const processData = () => {
+ const legendData = [...new Set(props.dataList.map((item) => item[props.legendField]))];
+
+ return legendData.map((legendItem) => {
+ const seriesData = props.dataList
+ .filter((item) => item[props.legendField] === legendItem)
+ .sort((a, b) => new Date(a[props.xField]) - new Date(b[props.xField]))
+ .map((item) => ({
+ name: item[props.xField],
+ value: [item[props.xField], item[props.yField]]
+ }));
+
+ return {
+ name: legendItem,
+ type: 'line',
+ showSymbol: true,
+ data: seriesData
+ };
+ });
+};
+```
+处理传入的数据,根据 `legendField` 分组,对每组数据按 `xField` 排序,并转换为 ECharts 所需的格式。
+
+#### 2.5 获取图表配置
+```javascript
+const getOption = () => ({
+ tooltip: {
+ trigger: 'axis',
+ formatter: (params) => {
+ return `${params[0].axisValue}
` + params.map((item) => `${item.marker} ${item.seriesName}: ${item.value[1]}`).join('
');
+ }
+ },
+ // 其他配置...
+});
+```
+返回 ECharts 的配置对象,包括 tooltip、x 轴、y 轴、系列数据、图例和网格等配置。
+
+#### 2.6 更新图表
+```javascript
+const updateChart = () => {
+ if (!chart.value) return;
+
+ const option = getOption();
+ chart.value.setOption(option);
+};
+```
+如果 `chart` 实例存在,获取最新的图表配置并更新图表。
+
+#### 2.7 监听数据变化
+```javascript
+watch(
+ () => props.dataList,
+ () => {
+ updateChart();
+ },
+ { deep: true }
+);
+```
+当 `props.dataList` 发生变化时,调用 `updateChart` 方法更新图表。
+
+### 3. 样式部分
+```css
+.chart-container {
+ width: 100%;
+ height: 30vh;
+}
+```
+设置图表容器的宽度为 100%,高度为 30vh。
+
+## 五、注意事项
+- 确保项目中已经正确安装并配置了 `lime-echart` 插件。
+- 传入的 `dataList` 数据格式要符合要求,包含 `xField`、`yField` 和 `legendField` 对应的数据。
+- 由于使用了异步加载 ECharts,可能会有一定的延迟,需要确保在合适的时机初始化图表。
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/changelog.md b/uni_modules/wu-calendar/changelog.md
new file mode 100644
index 0000000..cbd309d
--- /dev/null
+++ b/uni_modules/wu-calendar/changelog.md
@@ -0,0 +1,145 @@
+## 1.5.6(2024-11-25)
+1. 修复上版本日历高度错误的bug
+2. 新增clearSelect方法用于清除日历选择
+3. 新增todayDefaultStyle属性用于控制是否显示今日默认样式
+## 1.5.5(2024-11-14)
+1. 通过减少view数量优化日历性能
+2. 修复nvue错误日历样式以及滑动时无法切换日历的bug
+3. 修复nvue警告
+## 1.5.4(2024-10-12)
+修复忘记删除方法,导致运行错误
+## 1.5.3(2024-10-12)
+更新nvue下可能会造成日历重叠的bug
+## 1.5.2(2024-06-14)
+修复错误style语法
+## 1.5.1(2024-06-11)
+修复弹窗确认与取消设置颜色不生效
+## 1.5.0(2024-06-03)
+1. 修复monthSwitch事件初始化时被触发的问题
+2. monthSwitch事件新增fullDate属性(用来方便直接获取字符串形式的完整日期)
+3. 日历新增confirmFullDate属性,用来指定在弹窗模式下的日期点击确认按钮时是否需要选择完整日期
+## 1.4.9(2024-05-08)
+更新域名
+## 1.4.8(2024-04-22)
+修复日历内外高度不一致的问题
+## 1.4.7(2024-04-16)
+增加 operationPosition 属性 用来控制弹窗日历取消和确认按钮的显示位置
+## 1.4.6(2024-04-16)
+新增属性 actBadgeColor, 当通过 `selected` 属性设置某个日期 `badgeColor`后,如果该日期被选择且主题色与 `badgeColor` 一致时,徽标会显示本颜色
+## 1.4.5(2024-04-15)
+1. 新增reset方法来重置日历数据
+2. 新增插槽-operation 用来自定义弹窗日历确认和取消按钮
+3. selected 属性新增 badgeColor 用来指定 badge 颜色
+4. close 事件改为弹窗日历点击mask关闭时触发,新增cancel事件,弹窗日历点击取消时触发。
+## 1.4.4(2024-01-19)
+修复vue2初始化时使用同一引用类型造成的bug
+## 1.4.3(2024-01-17)
+优化切换折叠状态时的记录方式
+## 1.4.2(2024-01-12)
+优化 monthShowCurrentMonth 属性, 如果仅显示当月直接不展示该元素。
+## 1.4.1(2024-01-12)
+优化 monthShowCurrentMonth 属性, 如果仅显示当月直接不展示该元素。
+## 1.4.0(2024-01-11)
+修复type="week"时找不到
+## 1.3.9(2024-01-10)
+优化: 将日历日期宽度固定改为跟随父级来决定宽度,避免出现父元素宽度变化带来的对不齐
+## 1.3.8(2024-01-04)
+1. 增加节日
+2. 日历增加自定义高度
+3. vue页面日历折叠时增加动效
+4. 增加头部插槽
+5. 仅显示当月时自动扩大间距,不会再出现下面一排空白的尴尬情况了
+## 1.3.7(2023-12-19)
+修复回到今日时没有正确记录折叠日期
+修复selected变化时无法正常更新打点信息
+## 1.3.6(2023-12-13)
+修复单选模式下选中时展示的错误的weeks
+## 1.3.5(2023-12-13)
+修复动态修改date以及其他会触发更新init的函数, swiper不对及只会更新一个下一个数据的bug
+## 1.3.4(2023-12-08)
+修复selectd没有启用深度监听,导致直接添加数组带来的异常
+## 1.3.3(2023-11-23)
+1. 修复weeks错误类型提示
+2. 修复calendarChange返回month类型不对
+## 1.3.2(2023-11-22)
+修复将今日日期打点禁用后造成的bug
+## 1.3.1(2023-11-21)
+1. 修复wu-icon依赖缺失
+2. 新增rangeHaveDisableTruncation属性, 用来指定范围选择遇到打点禁用日期是否进行截断
+## 1.3.0(2023-11-19)
+1. 日历新增类型(周、月日历)
+2. 日历新增折叠功能
+3. 日历新增以周几开始的属性(周日、周一)
+## 1.2.9(2023-11-08)
+1. 修复mode变化时,不会正确重置的问题
+2. 优化月份大文字显示方式
+## 1.2.8(2023-10-22)
+新增maskClick用来控制是否点击遮罩层关闭
+新增disabledChoice用来控制是否禁止点击日历
+## 1.2.7(2023-09-22)
+修复传date值情况下不会默认选中的bug
+## 1.2.6(2023-09-22)
+修改useToday描述
+## 1.2.5(2023-09-22)
+新增useToday属性用来指定是否使用今天作为默认时间
+## 1.2.4(2023-09-21)
+修复插入模式下顶部会显示弹窗关闭的内容
+## 1.2.3(2023-09-20)
+修复恢复默认数据错误的bug
+## 1.2.2(2023-09-19)
+新增rangeSameDay属性用来指定选日期范围选择时起始日期是否可以为同一天
+## 1.2.1(2023-09-18)
+1.修复wu-calendar回到今日错误
+2.优化wu-calendar picker日期与当前日历日期同步
+3.wu-calendar新增mode属性,用来控制单日期、多日期、日期选择范围模式
+4.优化wu-calendar date属性来更好的指定多日期、范围日期的默认值
+## 1.2.0(2023-09-17)
+修复date变化时未成功重置
+## 1.1.9(2023-09-17)
+1. 新增mode属性用来指定日期选择模式
+2. 增加多选
+3. 增加范围选择模式、多选模式默认值
+## 1.1.8(2023-09-12)
+修复回到今日错误
+新增日历picker日期与日历同步
+## 1.1.7(2023-09-11)
+自定义事件声明
+## 1.1.6(2023-09-09)
+增加 `rangeEndRepick` 属性,用来指定选择完成后点击选择范围内的日期是否可以重选结束日期
+## 1.1.5(2023-09-09)
+修复每月仅显示当月数据时上方星期错乱的问题
+## 1.1.4(2023-09-05)
+1. 优化动态计算算法
+2. 优化弹窗模式打开缓慢的问题
+3. 优化Color方法
+## 1.1.3(2023-09-03)
+新增插件预览图片
+## 1.1.2(2023-09-02)
+1. 新增monthShowCurrentMonth 用来设置是否每月仅展示当月数据
+2. 修复动态加载时下一月数据更新错误问题
+3. 修复confirm和change事件选中的列表中有被禁止的日期的问题
+## 1.1.1(2023-08-31)
+修复在插入模式中无法滑动的bug
+## 1.1.0(2023-08-29)
+修复回到今日bug(来自群里464与A毛毛大佬的测试)
+## 1.0.9(2023-08-29)
+修复依赖缺失
+## 1.0.8(2023-08-22)
+修复v2初始化时使用不存在的属性导致不可使用的bug(来自wu-ui群内攸宁大佬的反馈)
+## 1.0.7(2023-08-21)
+阻止默认滑动事件执行
+## 1.0.6(2023-08-21)
+修复支付宝高度消失的问题
+## 1.0.5(2023-08-21)
+修改说明
+## 1.0.4(2023-08-20)
+去除误加打印
+## 1.0.3(2023-08-20)
+1. 修复初始化时下个月份日期计算不对的问题
+2. 增加打点禁用、设置打点徽标位置
+## 1.0.2(2023-08-20)
+更新展示截图
+## 1.0.1(2023-08-20)
+修改展示截图及说明
+## 1.0.0(2023-08-20)
+动态滑动计算的日历插件,还可以设置滑动切换模式、自定义主题颜色、自定义文案、农历显示等功能,可以让您纵享丝滑的使用日历。
diff --git a/uni_modules/wu-calendar/components/i18n/en.json b/uni_modules/wu-calendar/components/i18n/en.json
new file mode 100644
index 0000000..00b62e2
--- /dev/null
+++ b/uni_modules/wu-calendar/components/i18n/en.json
@@ -0,0 +1,14 @@
+{
+ "wu-calender.ok": "ok",
+ "wu-calender.cancel": "cancel",
+ "wu-calender.year": "year",
+ "wu-calender.month": "month",
+ "wu-calender.today": "today",
+ "wu-calender.MON": "MON",
+ "wu-calender.TUE": "TUE",
+ "wu-calender.WED": "WED",
+ "wu-calender.THU": "THU",
+ "wu-calender.FRI": "FRI",
+ "wu-calender.SAT": "SAT",
+ "wu-calender.SUN": "SUN"
+}
diff --git a/uni_modules/wu-calendar/components/i18n/index.js b/uni_modules/wu-calendar/components/i18n/index.js
new file mode 100644
index 0000000..de7509c
--- /dev/null
+++ b/uni_modules/wu-calendar/components/i18n/index.js
@@ -0,0 +1,8 @@
+import en from './en.json'
+import zhHans from './zh-Hans.json'
+import zhHant from './zh-Hant.json'
+export default {
+ en,
+ 'zh-Hans': zhHans,
+ 'zh-Hant': zhHant
+}
diff --git a/uni_modules/wu-calendar/components/i18n/zh-Hans.json b/uni_modules/wu-calendar/components/i18n/zh-Hans.json
new file mode 100644
index 0000000..1cfcb2d
--- /dev/null
+++ b/uni_modules/wu-calendar/components/i18n/zh-Hans.json
@@ -0,0 +1,14 @@
+{
+ "wu-calender.ok": "确定",
+ "wu-calender.cancel": "取消",
+ "wu-calender.year": "年",
+ "wu-calender.month": "月",
+ "wu-calender.today": "今日",
+ "wu-calender.SUN": "日",
+ "wu-calender.MON": "一",
+ "wu-calender.TUE": "二",
+ "wu-calender.WED": "三",
+ "wu-calender.THU": "四",
+ "wu-calender.FRI": "五",
+ "wu-calender.SAT": "六"
+}
diff --git a/uni_modules/wu-calendar/components/i18n/zh-Hant.json b/uni_modules/wu-calendar/components/i18n/zh-Hant.json
new file mode 100644
index 0000000..5ac1476
--- /dev/null
+++ b/uni_modules/wu-calendar/components/i18n/zh-Hant.json
@@ -0,0 +1,14 @@
+{
+ "wu-calender.ok": "確定",
+ "wu-calender.cancel": "取消",
+ "wu-calender.year": "年",
+ "wu-calender.month": "月",
+ "wu-calender.today": "今日",
+ "wu-calender.SUN": "日",
+ "wu-calender.MON": "一",
+ "wu-calender.TUE": "二",
+ "wu-calender.WED": "三",
+ "wu-calender.THU": "四",
+ "wu-calender.FRI": "五",
+ "wu-calender.SAT": "六"
+}
diff --git a/uni_modules/wu-calendar/components/wu-calendar-block/props.js b/uni_modules/wu-calendar/components/wu-calendar-block/props.js
new file mode 100644
index 0000000..fefc6e7
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar-block/props.js
@@ -0,0 +1,73 @@
+export default {
+ props: {
+ showMonth: {
+ type: Boolean,
+ default: false
+ },
+ // 折叠状态
+ FoldStatus: {
+ type: String,
+ default: null
+ },
+ month: {
+ type: [Number, String],
+ default: null
+ },
+ color: {
+ type: String,
+ default: '#3c9cff'
+ },
+ startText: {
+ type: String,
+ default: '开始'
+ },
+ endText: {
+ type: String,
+ default: '结束'
+ },
+ weeks: {
+ type: [Object, Array],
+ default: () => {
+ return []
+ }
+ },
+ calendar: {
+ type: Object,
+ default: () => {
+ return {}
+ }
+ },
+ selected: {
+ type: Array,
+ default: () => {
+ return []
+ }
+ },
+ lunar: {
+ type: Boolean,
+ default: false
+ },
+ itemHeight: {
+ type: Number,
+ default: 64
+ },
+ monthShowCurrentMonth: {
+ type: Boolean,
+ default: false
+ },
+ actBadgeColor: {
+ type: String,
+ default: '#fff'
+ },
+ // 默认边距 theme.scss
+ defaultMargin: {
+ type: Number,
+ default: 8
+ },
+ // 是否显示今日默认样式(默认为true)
+ todayDefaultStyle: {
+ type: Boolean,
+ default: true
+ },
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar-block/wu-calendar-block.vue b/uni_modules/wu-calendar/components/wu-calendar-block/wu-calendar-block.vue
new file mode 100644
index 0000000..d62597c
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar-block/wu-calendar-block.vue
@@ -0,0 +1,121 @@
+
+
+
+ {{ month }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar-item/props.js b/uni_modules/wu-calendar/components/wu-calendar-item/props.js
new file mode 100644
index 0000000..d66be3b
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar-item/props.js
@@ -0,0 +1,55 @@
+export default {
+ props: {
+ color: {
+ type: String,
+ default: '#3c9cff'
+ },
+ startText: {
+ type: String,
+ default: '开始'
+ },
+ endText: {
+ type: String,
+ default: '结束'
+ },
+ weeks: {
+ type: Object,
+ default () {
+ return {}
+ }
+ },
+ calendar: {
+ type: Object,
+ default: () => {
+ return {}
+ }
+ },
+ selected: {
+ type: Array,
+ default: () => {
+ return []
+ }
+ },
+ lunar: {
+ type: Boolean,
+ default: false
+ },
+ itemHeight: {
+ type: Number,
+ default: 64
+ },
+ actBadgeColor: {
+ type: String,
+ default: '#fff',
+ },
+ weekItemStyle: {
+ type: Object,
+ default: {}
+ },
+ // 是否显示今日默认样式(默认为true)
+ todayDefaultStyle: {
+ type: Boolean,
+ default: true
+ },
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar-item/wu-calendar-item.vue b/uni_modules/wu-calendar/components/wu-calendar-item/wu-calendar-item.vue
new file mode 100644
index 0000000..d46820e
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar-item/wu-calendar-item.vue
@@ -0,0 +1,291 @@
+
+
+
+
+
+ {{ weeks.extraInfo.topInfo }}
+
+
+
+
+ {{ weeks.date }}
+
+
+ {{ todayText }}
+
+
+
+ {{ dayText }}
+
+
+
+ {{ multipleText }}
+
+
+
+ {{ weeks.extraInfo.info }}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar/calendar.js b/uni_modules/wu-calendar/components/wu-calendar/calendar.js
new file mode 100644
index 0000000..2761a6d
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar/calendar.js
@@ -0,0 +1,664 @@
+/**
+ * @1900-2100区间内的公历、农历互转
+ * @charset UTF-8
+ * @github https://github.com/jjonline/calendar.js
+ * @Author Jea杨(JJonline@JJonline.Cn)
+ * @Time 2014-7-21
+ * @Time 2016-8-13 Fixed 2033hex、Attribution Annals
+ * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
+ * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
+ * @Version 1.0.3
+ * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
+ * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
+ */
+/* eslint-disable */
+var calendar = {
+
+ /**
+ * 农历1900-2100的润大小信息表
+ * @Array Of Property
+ * @return Hex
+ */
+ lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0,
+ 0x055d2, // 1900-1909
+ 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
+ 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
+ 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
+ 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
+ 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
+ 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
+ 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
+ 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
+ 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
+ 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
+ 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
+ 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
+ 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
+ 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
+ /** Add By JJonline@JJonline.Cn**/
+ 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
+ 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
+ 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
+ 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
+ 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
+ 0x0d520
+ ], // 2100
+
+ /**
+ * 公历每个月份的天数普通表
+ * @Array Of Property
+ * @return Number
+ */
+ solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
+
+ /**
+ * 天干地支之天干速查表
+ * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
+ * @return Cn string
+ */
+ Gan: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'],
+
+ /**
+ * 天干地支之地支速查表
+ * @Array Of Property
+ * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
+ * @return Cn string
+ */
+ Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149',
+ '\u620c', '\u4ea5'
+ ],
+
+ /**
+ * 天干地支之地支速查表<=>生肖
+ * @Array Of Property
+ * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
+ * @return Cn string
+ */
+ Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21',
+ '\u72d7', '\u732a'
+ ],
+
+ /**
+ * 24节气速查表
+ * @Array Of Property
+ * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
+ * @return Cn string
+ */
+ solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206',
+ '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3',
+ '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206',
+ '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'
+ ],
+
+ /**
+ * 1900-2100各年的24节气日期速查表
+ * @Array Of Property
+ * @return 0x string For splice
+ */
+ sTermInfo: [
+ '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f',
+ '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
+ '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa',
+ '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
+ 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f',
+ '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa',
+ '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
+ '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f',
+ '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e',
+ '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
+ '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f',
+ '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
+ '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
+ '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f',
+ '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
+ '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
+ '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722',
+ '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
+ '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
+ '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722',
+ '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e',
+ '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
+ '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722',
+ '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e',
+ '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
+ '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
+ '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
+ '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
+ '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
+ '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721',
+ '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
+ '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
+ '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
+ '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721',
+ '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2',
+ '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722',
+ '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
+ '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd',
+ '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722',
+ '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
+ '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
+ '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
+ '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722',
+ '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
+ '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721',
+ '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5',
+ '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722',
+ '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
+ '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
+ '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35',
+ '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
+ '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721',
+ '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd',
+ '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35',
+ '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722',
+ '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721',
+ '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
+ '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
+ '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721',
+ '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
+ '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
+ '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'
+ ],
+
+ festivals: {
+ '1-1': '元旦',
+ '2-14': '情人节',
+ '3-8': '妇女节',
+ '3-12': '植树节',
+ '4-1': '愚人节',
+ '5-1': '劳动节',
+ '5-4': '青年节',
+ '5-12': '护士节',
+ '6-1': '儿童节',
+ '8-1': '建军节',
+ '9-10': '教师节',
+ '10-1': '国庆',
+ '11-1': '万圣节',
+ '12-24': '圣诞节',
+ '正月初一': '春节',
+ '二月初二': '龙抬头',
+ '五月初五': '端午节',
+ '七月初七': '七夕节',
+ '七月十五': '中元节',
+ '八月十五': '中秋节',
+ '九月初九': '重阳节',
+ '腊月初八': '腊八节',
+ '腊月廿三': '小年',
+ '腊月三十': '除夕',
+ },
+
+ /**
+ * 数字转中文速查表
+ * @Array Of Property
+ * @trans ['日','一','二','三','四','五','六','七','八','九','十']
+ * @return Cn string
+ */
+ nStr1: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d',
+ '\u5341'
+ ],
+
+ /**
+ * 日期转农历称呼速查表
+ * @Array Of Property
+ * @trans ['初','十','廿','卅']
+ * @return Cn string
+ */
+ nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'],
+
+ /**
+ * 月份转农历称呼速查表
+ * @Array Of Property
+ * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
+ * @return Cn string
+ */
+ nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341',
+ '\u51ac', '\u814a'
+ ],
+
+ /**
+ * 返回农历y年一整年的总天数
+ * @param lunar Year
+ * @return Number
+ * @eg:var count = calendar.lYearDays(1987) ;//count=387
+ */
+ lYearDays: function(y) {
+ var i;
+ var sum = 348
+ for (i = 0x8000; i > 0x8; i >>= 1) {
+ sum += (this.lunarInfo[y - 1900] & i) ? 1 : 0
+ }
+ return (sum + this.leapDays(y))
+ },
+
+ /**
+ * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
+ * @param lunar Year
+ * @return Number (0-12)
+ * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
+ */
+ leapMonth: function(y) { // 闰字编码 \u95f0
+ return (this.lunarInfo[y - 1900] & 0xf)
+ },
+
+ /**
+ * 返回农历y年闰月的天数 若该年没有闰月则返回0
+ * @param lunar Year
+ * @return Number (0、29、30)
+ * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
+ */
+ leapDays: function(y) {
+ if (this.leapMonth(y)) {
+ return ((this.lunarInfo[y - 1900] & 0x10000) ? 30 : 29)
+ }
+ return (0)
+ },
+
+ /**
+ * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
+ * @param lunar Year
+ * @return Number (-1、29、30)
+ * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
+ */
+ monthDays: function(y, m) {
+ if (m > 12 || m < 1) {
+ return -1
+ } // 月份参数从1至12,参数错误返回-1
+ return ((this.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29)
+ },
+
+ /**
+ * 返回公历(!)y年m月的天数
+ * @param solar Year
+ * @return Number (-1、28、29、30、31)
+ * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
+ */
+ solarDays: function(y, m) {
+ if (m > 12 || m < 1) {
+ return -1
+ } // 若参数错误 返回-1
+ var ms = m - 1
+ if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
+ return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28)
+ } else {
+ return (this.solarMonth[ms])
+ }
+ },
+
+ /**
+ * 农历年份转换为干支纪年
+ * @param lYear 农历年的年份数
+ * @return Cn string
+ */
+ toGanZhiYear: function(lYear) {
+ var ganKey = (lYear - 3) % 10
+ var zhiKey = (lYear - 3) % 12
+ if (ganKey == 0) ganKey = 10 // 如果余数为0则为最后一个天干
+ if (zhiKey == 0) zhiKey = 12 // 如果余数为0则为最后一个地支
+ return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]
+ },
+
+ /**
+ * 公历月、日判断所属星座
+ * @param cMonth [description]
+ * @param cDay [description]
+ * @return Cn string
+ */
+ toAstro: function(cMonth, cDay) {
+ var s =
+ '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
+ var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]
+ return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + '\u5ea7' // 座
+ },
+
+ /**
+ * 传入offset偏移量返回干支
+ * @param offset 相对甲子的偏移量
+ * @return Cn string
+ */
+ toGanZhi: function(offset) {
+ return this.Gan[offset % 10] + this.Zhi[offset % 12]
+ },
+
+ /**
+ * 传入公历(!)y年获得该年第n个节气的公历日期
+ * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
+ * @return day Number
+ * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
+ */
+ getTerm: function(y, n) {
+ if (y < 1900 || y > 2100) {
+ return -1
+ }
+ if (n < 1 || n > 24) {
+ return -1
+ }
+ var _table = this.sTermInfo[y - 1900]
+ var _info = [
+ parseInt('0x' + _table.substr(0, 5)).toString(),
+ parseInt('0x' + _table.substr(5, 5)).toString(),
+ parseInt('0x' + _table.substr(10, 5)).toString(),
+ parseInt('0x' + _table.substr(15, 5)).toString(),
+ parseInt('0x' + _table.substr(20, 5)).toString(),
+ parseInt('0x' + _table.substr(25, 5)).toString()
+ ]
+ var _calday = [
+ _info[0].substr(0, 1),
+ _info[0].substr(1, 2),
+ _info[0].substr(3, 1),
+ _info[0].substr(4, 2),
+
+ _info[1].substr(0, 1),
+ _info[1].substr(1, 2),
+ _info[1].substr(3, 1),
+ _info[1].substr(4, 2),
+
+ _info[2].substr(0, 1),
+ _info[2].substr(1, 2),
+ _info[2].substr(3, 1),
+ _info[2].substr(4, 2),
+
+ _info[3].substr(0, 1),
+ _info[3].substr(1, 2),
+ _info[3].substr(3, 1),
+ _info[3].substr(4, 2),
+
+ _info[4].substr(0, 1),
+ _info[4].substr(1, 2),
+ _info[4].substr(3, 1),
+ _info[4].substr(4, 2),
+
+ _info[5].substr(0, 1),
+ _info[5].substr(1, 2),
+ _info[5].substr(3, 1),
+ _info[5].substr(4, 2)
+ ]
+ return parseInt(_calday[n - 1])
+ },
+
+ /**
+ * 传入农历数字月份返回汉语通俗表示法
+ * @param lunar month
+ * @return Cn string
+ * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
+ */
+ toChinaMonth: function(m) { // 月 => \u6708
+ if (m > 12 || m < 1) {
+ return -1
+ } // 若参数错误 返回-1
+ var s = this.nStr3[m - 1]
+ s += '\u6708' // 加上月字
+ return s
+ },
+
+ /**
+ * 传入农历日期数字返回汉字表示法
+ * @param lunar day
+ * @return Cn string
+ * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
+ */
+ toChinaDay: function(d) { // 日 => \u65e5
+ var s
+ switch (d) {
+ case 10:
+ s = '\u521d\u5341';
+ break
+ case 20:
+ s = '\u4e8c\u5341';
+ break
+ break
+ case 30:
+ s = '\u4e09\u5341';
+ break
+ break
+ default:
+ s = this.nStr2[Math.floor(d / 10)]
+ s += this.nStr1[d % 10]
+ }
+ return (s)
+ },
+
+ /**
+ * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
+ * @param y year
+ * @return Cn string
+ * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
+ */
+ getAnimal: function(y) {
+ return this.Animals[(y - 4) % 12]
+ },
+
+ /**
+ * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
+ * @param y solar year
+ * @param m solar month
+ * @param d solar day
+ * @return JSON object
+ * @eg:console.log(calendar.solar2lunar(1987,11,01));
+ */
+ solar2lunar: function(y, m, d) { // 参数区间1900.1.31~2100.12.31
+ // 年份限定、上限
+ if (y < 1900 || y > 2100) {
+ return -1 // undefined转换为数字变为NaN
+ }
+ // 公历传参最下限
+ if (y == 1900 && m == 1 && d < 31) {
+ return -1
+ }
+ // 未传参 获得当天
+ if (!y) {
+ var objDate = new Date()
+ } else {
+ var objDate = new Date(y, parseInt(m) - 1, d)
+ }
+ var i;
+ var leap = 0;
+ var temp = 0
+ // 修正ymd参数
+ var y = objDate.getFullYear()
+ var m = objDate.getMonth() + 1
+ var d = objDate.getDate()
+ var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0,
+ 31)) / 86400000
+ for (i = 1900; i < 2101 && offset > 0; i++) {
+ temp = this.lYearDays(i)
+ offset -= temp
+ }
+ if (offset < 0) {
+ offset += temp;
+ i--
+ }
+
+ // 是否今天
+ var isTodayObj = new Date()
+ var isToday = false
+ if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
+ isToday = true
+ }
+ // 星期几
+ var nWeek = objDate.getDay()
+ var cWeek = this.nStr1[nWeek]
+ // 数字表示周几顺应天朝周一开始的惯例
+ if (nWeek == 0) {
+ nWeek = 7
+ }
+ // 农历年
+ var year = i
+ var leap = this.leapMonth(i) // 闰哪个月
+ var isLeap = false
+
+ // 效验闰月
+ for (i = 1; i < 13 && offset > 0; i++) {
+ // 闰月
+ if (leap > 0 && i == (leap + 1) && isLeap == false) {
+ --i
+ isLeap = true;
+ temp = this.leapDays(year) // 计算农历闰月天数
+ } else {
+ temp = this.monthDays(year, i) // 计算农历普通月天数
+ }
+ // 解除闰月
+ if (isLeap == true && i == (leap + 1)) {
+ isLeap = false
+ }
+ offset -= temp
+ }
+ // 闰月导致数组下标重叠取反
+ if (offset == 0 && leap > 0 && i == leap + 1) {
+ if (isLeap) {
+ isLeap = false
+ } else {
+ isLeap = true;
+ --i
+ }
+ }
+ if (offset < 0) {
+ offset += temp;
+ --i
+ }
+ // 农历月
+ var month = i
+ // 农历日
+ var day = offset + 1
+ // 天干地支处理
+ var sm = m - 1
+ var gzY = this.toGanZhiYear(year)
+
+ // 当月的两个节气
+ // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
+ var firstNode = this.getTerm(y, (m * 2 - 1)) // 返回当月「节」为几日开始
+ var secondNode = this.getTerm(y, (m * 2)) // 返回当月「节」为几日开始
+
+ // 依据12节气修正干支月
+ var gzM = this.toGanZhi((y - 1900) * 12 + m + 11)
+ if (d >= firstNode) {
+ gzM = this.toGanZhi((y - 1900) * 12 + m + 12)
+ }
+
+ // 传入的日期的节气与否
+ var isTerm = false
+ var Term = null
+ if (firstNode == d) {
+ isTerm = true
+ Term = this.solarTerm[m * 2 - 2]
+ }
+ if (secondNode == d) {
+ isTerm = true
+ Term = this.solarTerm[m * 2 - 1]
+ }
+
+ // 计算农历日期
+ const IMonthCn = (isLeap ? '\u95f0' : '') + this.toChinaMonth(month)
+ // 农历日期的汉字表述法
+ let IDayCn = this.toChinaDay(day)
+
+ // 节日
+ let festival = '';
+ // 农历的月日汉字表述
+ let lMDcn = IMonthCn + IDayCn;
+ // 月份日期
+ let MD = m + '-' + d;
+ if (this.festivals.hasOwnProperty(lMDcn)) {
+ festival = this.festivals[lMDcn]
+ } else if(this.festivals.hasOwnProperty(MD)) {
+ festival = this.festivals[MD]
+ }
+
+ // 日柱 当月一日与 1900/1/1 相差天数
+ var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10
+ var gzD = this.toGanZhi(dayCyclical + d - 1)
+ // 该日期所属的星座
+ var astro = this.toAstro(m, d)
+
+ return {
+ 'lYear': year,
+ 'lMonth': month,
+ 'lDay': day,
+ 'Animal': this.getAnimal(year),
+ 'IMonthCn': IMonthCn,
+ 'IDayCn': IDayCn,
+ 'cYear': y,
+ 'cMonth': m,
+ 'cDay': d,
+ 'gzYear': gzY,
+ 'gzMonth': gzM,
+ 'gzDay': gzD,
+ 'isToday': isToday,
+ 'isLeap': isLeap,
+ 'nWeek': nWeek,
+ 'ncWeek': '\u661f\u671f' + cWeek,
+ 'isTerm': isTerm,
+ 'Term': Term,
+ 'astro': astro,
+ 'festival': festival
+ }
+ },
+
+ /**
+ * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
+ * @param y lunar year
+ * @param m lunar month
+ * @param d lunar day
+ * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
+ * @return JSON object
+ * @eg:console.log(calendar.lunar2solar(1987,9,10));
+ */
+ lunar2solar: function(y, m, d, isLeapMonth) { // 参数区间1900.1.31~2100.12.1
+ var isLeapMonth = !!isLeapMonth
+ var leapOffset = 0
+ var leapMonth = this.leapMonth(y)
+ var leapDay = this.leapDays(y)
+ if (isLeapMonth && (leapMonth != m)) {
+ return -1
+ } // 传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
+ if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) {
+ return -1
+ } // 超出了最大极限值
+ var day = this.monthDays(y, m)
+ var _day = day
+ // bugFix 2016-9-25
+ // if month is leap, _day use leapDays method
+ if (isLeapMonth) {
+ _day = this.leapDays(y, m)
+ }
+ if (y < 1900 || y > 2100 || d > _day) {
+ return -1
+ } // 参数合法性效验
+
+ // 计算农历的时间差
+ var offset = 0
+ for (var i = 1900; i < y; i++) {
+ offset += this.lYearDays(i)
+ }
+ var leap = 0;
+ var isAdd = false
+ for (var i = 1; i < m; i++) {
+ leap = this.leapMonth(y)
+ if (!isAdd) { // 处理闰月
+ if (leap <= i && leap > 0) {
+ offset += this.leapDays(y);
+ isAdd = true
+ }
+ }
+ offset += this.monthDays(y, i)
+ }
+ // 转换闰月农历 需补充该年闰月的前一个月的时差
+ if (isLeapMonth) {
+ offset += day
+ }
+ // 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
+ var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
+ var calObj = new Date((offset + d - 31) * 86400000 + stmap)
+ var cY = calObj.getUTCFullYear()
+ var cM = calObj.getUTCMonth() + 1
+ var cD = calObj.getUTCDate()
+
+ return this.solar2lunar(cY, cM, cD)
+ }
+}
+
+export default calendar
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar/props.js b/uni_modules/wu-calendar/components/wu-calendar/props.js
new file mode 100644
index 0000000..b412251
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar/props.js
@@ -0,0 +1,166 @@
+export default {
+ props: {
+ // 自定义当前时间
+ date: {
+ type: [String, Array],
+ default: ''
+ },
+ // 日历类型(默认为month)
+ type: {
+ type: String,
+ default: 'month',
+ validator(value) {
+ return ['month', 'week'].includes(value)
+ }
+ },
+ // 日期选择模式
+ mode: {
+ type: String,
+ default: 'single'
+ },
+ // 是否使用默认日期(今天,默认为true)
+ useToday: {
+ type: Boolean,
+ default: true
+ },
+ // 是否显示今日默认样式(默认为true)
+ todayDefaultStyle: {
+ type: Boolean,
+ default: true
+ },
+ // 是否使用折叠功能
+ fold: {
+ type: Boolean,
+ default: null
+ },
+ // 主题色
+ color: {
+ type: String,
+ default: '#3c9cff'
+ },
+ // 日历中每一项日期的高度(默认70),单位px
+ itemHeight: {
+ type: Number,
+ default: 70
+ },
+ // 取消文字的颜色
+ cancelColor: {
+ type: String,
+ default: '#333'
+ },
+ // 确定文字的颜色
+ confirmColor: {
+ type: String,
+ default: '#333'
+ },
+ // mode=range时,第一个日期底部的提示文字
+ startText: {
+ type: String,
+ default: '开始'
+ },
+ // mode=range时,最后一个日期底部的提示文字
+ endText: {
+ type: String,
+ default: '结束'
+ },
+ // 日历以周几开始
+ startWeek: {
+ type: String,
+ default: 'sun',
+ validator(value) {
+ return ['sun', 'mon'].includes(value)
+ }
+ },
+ // 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
+ selected: {
+ type: Array,
+ default () {
+ return []
+ }
+ },
+ // 是否显示农历
+ lunar: {
+ type: Boolean,
+ default: false
+ },
+ // 日期选择范围-开始日期
+ startDate: {
+ type: String,
+ default: ''
+ },
+ // 日期选择范围-结束日期
+ endDate: {
+ type: String,
+ default: ''
+ },
+ // 允许日期选择范围内重选结束日期
+ rangeEndRepick: {
+ type: Boolean,
+ default: false
+ },
+ // 允许日期选择范围起始日期为同一天
+ rangeSameDay: {
+ type: Boolean,
+ default: false
+ },
+ // 允许日期选择范围内遇到打点禁用日期进行截断
+ rangeHaveDisableTruncation: {
+ type: Boolean,
+ default: false
+ },
+ // 每月仅显示当月日期
+ monthShowCurrentMonth: {
+ type: Boolean,
+ default: false
+ },
+ // 插入模式,可选值,ture:插入模式;false:弹窗模式; 默认为插入模式
+ insert: {
+ type: Boolean,
+ default: true
+ },
+ // 滑动切换模式,可选值 horizontal: 横向 vertical:纵向 none: 不使用滑动切换
+ slideSwitchMode: {
+ type: String,
+ default: 'horizontal'
+ },
+ // 是否显示月份为背景
+ showMonth: {
+ type: Boolean,
+ default: true
+ },
+ // 弹窗模式是否清空上次选择内容
+ clearDate: {
+ type: Boolean,
+ default: true
+ },
+ // 是否点击遮罩层关闭
+ maskClick: {
+ type: Boolean,
+ default: false
+ },
+ // 是否禁止点击日历
+ disabledChoice: {
+ type: Boolean,
+ default: false
+ },
+ // 弹窗日历取消和确认按钮的显示位置
+ operationPosition: {
+ type: String,
+ default: 'top',
+ validator(value) {
+ return ['top', 'bottom'].includes(value)
+ }
+ },
+ // 弹窗日历点击确认时是否需要选择完整日期
+ confirmFullDate: {
+ type: Boolean,
+ default: false
+ },
+ // 当通过 `selected` 属性设置某个日期 `badgeColor`后,如果该日期被选择且主题色与 `badgeColor` 一致时,徽标会显示本颜色
+ actBadgeColor: {
+ type: String,
+ default: '#fff'
+ },
+ ...uni.$w?.props?.calendar
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar/util.js b/uni_modules/wu-calendar/components/wu-calendar/util.js
new file mode 100644
index 0000000..abc6ec2
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar/util.js
@@ -0,0 +1,553 @@
+import calendar from './calendar.js';
+import CALENDAR from './calendar.js'
+
+class Calendar {
+ constructor({
+ date,
+ selected,
+ startDate,
+ endDate,
+ mode,
+ monthShowCurrentMonth,
+ rangeEndRepick,
+ rangeSameDay,
+ rangeHaveDisableTruncation,
+ type,
+ foldStatus,
+ startWeek
+ } = {}) {
+ // 当前日期
+ this.date = this.getDate(new Date()) // 当前初入日期
+ // 打点信息
+ this.selected = selected || [];
+ // 范围开始
+ this.startDate = startDate
+ // 范围结束
+ this.endDate = endDate
+ // 日历以周几开始
+ this.startWeek = startWeek
+ // 日期选择类型
+ this.mode = mode
+ // 日历类型
+ this.type = type
+ // 折叠状态
+ this.foldStatus = foldStatus
+ // 允许范围内重选结束日期
+ this.rangeEndRepick = rangeEndRepick
+ // 允许日期选择范围起始日期为同一天
+ this.rangeSameDay = rangeSameDay
+ // 日期选择范围内遇到打点禁用日期是否截断
+ this.rangeHaveDisableTruncation = rangeHaveDisableTruncation
+ // 每月是否仅显示当月的数据
+ this.monthShowCurrentMonth = monthShowCurrentMonth
+ // 清理多选状态
+ this.cleanRange()
+ // 每周日期
+ this.weeks = {}
+ // 多个日期
+ this.multiple = [];
+ }
+ /**
+ * 设置日期
+ * @param {Object} date
+ */
+ setDate(date) {
+ this.selectDate = this.getDate(date)
+ this._getWeek(this.selectDate.fullDate)
+ }
+
+ /**
+ * 清除范围
+ */
+ cleanRange() {
+ this.rangeStatus = {
+ before: '',
+ after: '',
+ data: []
+ }
+ }
+
+ /**
+ * 清除多选
+ */
+ cleanMultiple() {
+ this.multiple = []
+ }
+
+ /**
+ * 重置开始日期
+ */
+ resetSatrtDate(startDate) {
+ // 范围开始
+ this.startDate = startDate
+ }
+
+ /**
+ * 重置结束日期
+ */
+ resetEndDate(endDate) {
+ // 范围结束
+ this.endDate = endDate
+ }
+
+ /**
+ * 重置是否每月仅显示当月数据
+ * @param {Boolean} show 是否仅显示当月数据
+ */
+ resetMonthShowCurrentMonth(show) {
+ this.monthShowCurrentMonth = show
+ }
+
+ // 重置允许范围内重选结束日期
+ resetRangeEndRepick(val) {
+ this.rangeEndRepick = val
+ }
+
+ // 重置允许日期范围选择起始日期为同一天
+ resetRangeSameDay(val) {
+ this.rangeSameDay = val
+ }
+
+ // 重置范围内遇到打点禁用日期是否截断
+ resetRangeHaveDisableTruncation(val) {
+ this.rangeHaveDisableTruncation = val
+ }
+
+ // 重置日期选择模式
+ resetMode(val) {
+ this.mode = val
+ }
+
+ // 重置折叠状态
+ resetFoldStatus(val) {
+ this.foldStatus = val
+ }
+
+ // 重置日历以周几开始
+ resetStartWeek(val) {
+ this.startWeek = val
+ }
+
+ /**
+ * 创建本月某一天的信息
+ */
+ _createCurrentDay(nowDate, full, date) {
+ // 是否今天
+ let isDay = this.date.fullDate === nowDate
+ // 获取打点信息
+ let info = this.selected && this.selected.find((item) => {
+ if (this.dateEqual(nowDate, item.date)) {
+ return item
+ }
+ })
+
+ // 日期禁用
+ let disableBefore = true
+ let disableAfter = true
+ if (this.startDate) {
+ disableBefore = this.dateCompare(this.startDate, nowDate)
+ }
+
+ if (this.endDate) {
+ disableAfter = this.dateCompare(nowDate, this.endDate)
+ }
+
+ // 范围选择模式
+ let ranges = this.rangeStatus.data
+ let checked = false
+ if (this.mode == 'range') {
+ checked = ranges.findIndex((item) => this.dateEqual(item, nowDate)) !== -1 ? true : false;
+ }
+
+ // 多日期选择模式
+ let multiples = this.multiple
+ let multiplesChecked = false
+ if (this.mode == 'multiple') {
+ multiplesChecked = multiples.findIndex(item => this.dateEqual(item, nowDate)) !== -1;
+ }
+
+ let data = {
+ fullDate: nowDate,
+ year: full.year,
+ date,
+ type: this.type,
+ mode: this.mode,
+ multiples: this.mode == 'multiple' ? multiplesChecked : false,
+ rangeMultiple: this.mode == 'range' ? checked : false,
+ beforeRange: this.dateEqual(this.rangeStatus.before, nowDate),
+ afterRange: this.dateEqual(this.rangeStatus.after, nowDate),
+ month: full.month,
+ lunar: this.getlunar(full.year, full.month, date),
+ disable: !(disableBefore && disableAfter),
+ isDay
+ }
+
+
+ if (info) {
+ data.extraInfo = info;
+ data.disable = info.disable || false;
+ }
+
+ return data
+ }
+
+ /**
+ * 获取任意时间
+ */
+ getDate(date, AddDayCount = 0, str = 'day') {
+ if (!date) {
+ date = new Date()
+ }
+ if (typeof date !== 'object') {
+ date = date.replace(/-/g, '/')
+ }
+ const dd = new Date(date)
+ switch (str) {
+ case 'day':
+ dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
+ break
+ case 'month':
+ if (dd.getDate() === 31 && AddDayCount > 0) {
+ dd.setDate(dd.getDate() + AddDayCount)
+ } else {
+ const preMonth = dd.getMonth()
+ dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期
+ const nextMonth = dd.getMonth()
+ // 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
+ if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) {
+ dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount))
+ }
+ // 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
+ if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) {
+ dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount))
+ }
+ }
+ break
+ case 'week':
+ dd.setDate(dd.getDate() + (AddDayCount * 7))
+ break;
+ case 'year':
+ dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
+ break
+ }
+ const y = dd.getFullYear()
+ const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
+ const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
+ return {
+ fullDate: y + '-' + m + '-' + d,
+ year: y,
+ month: m,
+ date: d,
+ day: dd.getDay()
+ }
+ }
+
+
+ /**
+ * 获取上月剩余天数
+ */
+ _getLastMonthDays(firstDay, full) {
+ let dateArr = []
+ for (let i = firstDay; i > 0; i--) {
+ const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate()
+ dateArr.push({
+ date: beforeDate,
+ month: full.month - 1,
+ year: full.year,
+ lunar: this.getlunar(full.year, full.month - 1, beforeDate),
+ disable: true
+ })
+ }
+ return dateArr
+ }
+ /**
+ * 获取本月天数
+ */
+ _currentMonthDays(dateData, full) {
+ let dateArr = []
+ let fullDate = this.date.fullDate
+ for (let i = 1; i <= dateData; i++) {
+ let nowDate = full.year + '-' + (full.month < 10 ?
+ full.month : full.month) + '-' + (i < 10 ?
+ '0' + i : i)
+ dateArr.push(this._createCurrentDay(nowDate, full, i))
+ }
+ return dateArr
+ }
+ /**
+ * 获取下月天数
+ */
+ _getNextMonthDays(surplus, full) {
+ let dateArr = []
+ for (let i = 1; i < surplus + 1; i++) {
+ dateArr.push({
+ date: i,
+ month: Number(full.month) + 1,
+ lunar: this.getlunar(full.year, Number(full.month) + 1, i),
+ disable: true
+ })
+ }
+ return dateArr
+ }
+ /**
+ * 获取任意日期的一周
+ */
+ _getWeekDays(dateData) {
+ let dateArr = [];
+ let oneDayTime = 1000 * 60 * 60 * 24
+ let today = new Date(dateData);
+ // 获取这个日期是星期几
+ let todayDay;
+ let startDate;
+ // 如果日历以周一开始
+ if (this.startWeek == 'mon') {
+ todayDay = today.getDay() || 7;
+ startDate = new Date(today.getTime() - oneDayTime * (todayDay - 1));
+ } else {
+ todayDay = today.getDay();
+ startDate = new Date(today.getTime() - oneDayTime * todayDay);
+ }
+
+ for (let i = 0; i < 7; i++) {
+ let temp = new Date(startDate.getTime() + i * oneDayTime)
+ let newDate = this.getDate(`${temp.getFullYear()}-${temp.getMonth() + 1}-${temp.getDate()}`)
+ dateArr.push(this._createCurrentDay(newDate.fullDate, newDate, Number(newDate.date)))
+ }
+
+ return dateArr;
+ }
+
+ /**
+ * 获取当前日期详情
+ * @param {Object} date
+ */
+ getInfo(date) {
+ if (!date) {
+ date = new Date()
+ }
+ const dateInfo = this.canlender.find(item => item.fullDate === this.getDate(date).fullDate)
+ return dateInfo
+ }
+
+ /**
+ * 比较时间大小
+ */
+ dateCompare(startDate, endDate) {
+ // 计算截止时间
+ startDate = new Date(startDate.replace('-', '/').replace('-', '/'))
+ // 计算详细项的截止时间
+ endDate = new Date(endDate.replace('-', '/').replace('-', '/'))
+ if (startDate <= endDate) {
+ return true
+ } else {
+ return false
+ }
+ }
+
+ /**
+ * 比较时间是否相等
+ */
+ dateEqual(before = '', after = '') {
+ // 计算截止时间
+ before = new Date(before.replace('-', '/').replace('-', '/'))
+ // 计算详细项的截止时间
+ after = new Date(after.replace('-', '/').replace('-', '/'))
+ if (before.getTime() - after.getTime() === 0) {
+ return true
+ } else {
+ return false
+ }
+ }
+
+
+ /**
+ * 获取日期范围内所有日期
+ * @param {Object} begin
+ * @param {Object} end
+ */
+ getDateAll(begin, end) {
+ // 找出所有打点中已禁用的部分 不让其被添加在日期选择范围内
+ let disableList = this.selected.filter(item => item.date && item.disable).map(item => item.date)
+
+ var arr = []
+ var ab = begin.split('-')
+ var ae = end.split('-')
+ var db = new Date()
+ db.setFullYear(ab[0], ab[1] - 1, ab[2])
+ var de = new Date()
+ de.setFullYear(ae[0], ae[1] - 1, ae[2])
+ var wuxDb = db.getTime() - 24 * 60 * 60 * 1000
+ var wuxDe = de.getTime() - 24 * 60 * 60 * 1000
+ for (var k = wuxDb; k <= wuxDe;) {
+ k = k + 24 * 60 * 60 * 1000
+ let fullDate = this.getDate(new Date(parseInt(k))).fullDate
+ // 如果要在选择范围内截断日期
+ if (this.rangeHaveDisableTruncation) {
+ // 如果不在打点禁止列表中
+ if (disableList.includes(fullDate)) return arr;
+ arr.push(fullDate)
+ } else {
+ if (!disableList.includes(fullDate)) arr.push(fullDate);
+ }
+ }
+ return arr
+ }
+ /**
+ * 计算阴历日期显示
+ */
+ getlunar(year, month, date) {
+ return CALENDAR.solar2lunar(year, month, date)
+ }
+ /**
+ * 设置打点
+ */
+ setSelectInfo(data, value) {
+ this.selected = value
+
+ this._getWeek(data)
+ }
+
+ /**
+ * 设置范围
+ */
+ setRange(fullDate) {
+ let {
+ before,
+ after
+ } = this.rangeStatus;
+
+ // 非范围选择不再执行
+ if (this.mode != 'range') return
+
+ // 判断目前的日期 是否 比before日期小或者等于before日期 如果为true就要重置
+ let reset = this.dateCompare(fullDate, before);
+ // 如果日期选择范围允许为同一天 且 目前是需要重置的
+ if (this.rangeSameDay && before && reset) {
+ // 判断是否需要相等 如果 不相等 则 重置 如果相等 则不重置
+ reset = !this.dateEqual(fullDate, before);
+ }
+
+ if ((before && after || reset) && (!this.rangeEndRepick || (this.rangeEndRepick && this.rangeStatus.data
+ .indexOf(fullDate) == -1))) {
+ this.rangeStatus.before = fullDate;
+ this.rangeStatus.after = '';
+ this.rangeStatus.data = [];
+ } else {
+ if (!before) {
+ this.rangeStatus.before = fullDate
+ } else {
+ if (this.dateCompare(this.rangeStatus.before, fullDate)) {
+ this.rangeStatus.data = this.getDateAll(this.rangeStatus.before, fullDate);
+ } else {
+ this.rangeStatus.data = this.getDateAll(fullDate, this.rangeStatus.before);
+ }
+ this.rangeStatus.after = this.rangeStatus.data[this.rangeStatus.data.length - 1]
+ }
+ }
+ this._getWeek(fullDate)
+ }
+
+ /**
+ * 设置多选
+ */
+ setMultiple(fullDate) {
+ // 非多选不再执行
+ if (this.mode != 'multiple') return
+ // 检查是否已经多选
+ let index = this.multiple.findIndex((item) => {
+ if (this.dateEqual(fullDate, item)) {
+ return item
+ }
+ });
+ if (index === -1) {
+ this.multiple.push(fullDate)
+ this.setDate(fullDate)
+ } else {
+ this.multiple = this.multiple.filter((item, i) => i != index)
+ }
+ this._getWeek(fullDate)
+ }
+
+ /**
+ * 获取每周数据
+ * @param {Object} dateData
+ */
+ _getWeek(dateData, useWeeks = true) {
+ const {
+ year,
+ month
+ } = this.getDate(dateData)
+
+ let weeks = {}
+ // 日历数据
+ let canlender = [];
+
+ if (this.foldStatus === 'open') {
+ // 默认以周末开始
+ let firstDay = new Date(year, month - 1, 1).getDay();
+ // 如果以周一开始
+ if (this.startWeek === 'mon') {
+ firstDay = firstDay === 0 ? 6 : firstDay - 1;
+ }
+ let currentDay = new Date(year, month, 0).getDate()
+ // 日期数据
+ let dates = {
+ lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)), // 上个月末尾几天
+ currentMonthDys: this._currentMonthDays(currentDay, this.getDate(dateData)), // 本月天数
+ weeks: []
+ }
+ // 下月开始几天
+ const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length)
+ dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData))
+
+ // 如果仅显示当月
+ if (this.monthShowCurrentMonth) {
+ // 日历数据
+ canlender = canlender.concat(
+ dates.lastMonthDays.map(item => item = {
+ empty: true,
+ lunar: {},
+ }),
+ dates.currentMonthDys,
+ dates.nextMonthDays.map(item => item = {
+ empty: true,
+ lunar: {},
+ }),
+ );
+
+ } else {
+ // 拼接数组 上个月开始几天 + 本月天数+ 下个月开始几天
+ canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays)
+ }
+
+ } else {
+ canlender = this._getWeekDays(dateData)
+ }
+
+ for (let i = 0; i < canlender.length; i++) {
+ if (i % 7 === 0) {
+ weeks[parseInt(i / 7)] = new Array(7)
+ }
+ weeks[parseInt(i / 7)][i % 7] = canlender[i] || {};
+ }
+
+ if (useWeeks) {
+ this.canlender = canlender
+ this.weeks = weeks
+ }
+
+ return weeks
+ }
+
+
+ //静态方法
+ // static init(date) {
+ // if (!this.instance) {
+ // this.instance = new Calendar(date);
+ // }
+ // return this.instance;
+ // }
+}
+
+
+export default Calendar
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/components/wu-calendar/wu-calendar.vue b/uni_modules/wu-calendar/components/wu-calendar/wu-calendar.vue
new file mode 100644
index 0000000..8fdddf4
--- /dev/null
+++ b/uni_modules/wu-calendar/components/wu-calendar/wu-calendar.vue
@@ -0,0 +1,1279 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 自然周期
+ 相对周期
+
+
+
+
+
+
+
+
+
+
+
+ {{ SUNText }}
+
+
+ {{ monText }}
+
+
+ {{ TUEText }}
+
+
+ {{ WEDText }}
+
+
+ {{ THUText }}
+
+
+ {{ FRIText }}
+
+
+ {{ SATText }}
+
+
+ {{ SUNText }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/wu-calendar/package.json b/uni_modules/wu-calendar/package.json
new file mode 100644
index 0000000..bd01fd7
--- /dev/null
+++ b/uni_modules/wu-calendar/package.json
@@ -0,0 +1,91 @@
+{
+ "id": "wu-calendar",
+ "displayName": "wu-calendar 最全日历,动态滑动切换、多滑动模式、多日历类型、多日期选择模式等,全端兼容,无论平台,一致体验。",
+ "version": "1.5.6",
+ "description": "唯一支持动态滑动计算的日历插件,多滑动切换模式(纵、横、不滑动)、多日历类型(周、月)、多日期选择模式(单选、多选、范围)、日历周几(周日、周一)、自定义主题、农历显示等,可以让您纵享丝滑的使用日历",
+ "keywords": [
+ "wu-calendar",
+ "日历",
+ "多日历类型",
+ "动态滑动计算",
+ "wu-ui"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.5.5"
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [
+ "wu-ui-tools",
+ "wu-icon",
+ "wu-safe-bottom"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y",
+ "alipay": "n"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y",
+ "app-uvue": "u"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-calendar/readme.md b/uni_modules/wu-calendar/readme.md
new file mode 100644
index 0000000..c69121d
--- /dev/null
+++ b/uni_modules/wu-calendar/readme.md
@@ -0,0 +1,16 @@
+## wu-calendar 最全日历
+
+> **组件名:wu-calendar**
+
+目前插件市场上唯一可以动态滑动计算的日历插件,多滑动切换模式(纵、横向滑动,不滑动)、多日历类型(周、月日历)、多日历选择模式(日期单选、多选、范围选择)、多日历起始周几设置(周日、周一)、自定义主题颜色(副色自动生成)、自定义文案、农历显示等功能,可以让您纵享丝滑的使用日历。
+
+## [查看文档](https://wuui.cn/zh-CN/components/calendar.html)
+
+## [更多组件, 请查看 `wu-ui` 组件库](https://ext.dcloud.net.cn/plugin?name=wu--ui)
+(请勿下载插件zip)
+
+
+
+
+
+**如使用过程中有任何问题,或者您对wu-ui有一些好的建议。
欢迎加入 [wu-ui 交流群](https://wuui.cn/zh-CN/components/qqFeedBack.html)**
\ No newline at end of file
diff --git a/uni_modules/wu-icon/changelog.md b/uni_modules/wu-icon/changelog.md
new file mode 100644
index 0000000..8b940ba
--- /dev/null
+++ b/uni_modules/wu-icon/changelog.md
@@ -0,0 +1,10 @@
+## 1.0.4(2024-05-08)
+更新域名
+## 1.0.3(2023-08-08)
+修复链接引入错误
+## 1.0.2(2023-08-07)
+修复引入错误
+## 1.0.1(2023-08-07)
+支持自定义(包括nvue)文字与图片图标
+## 1.0.0(2023-08-03)
+基于字体的图标集,包含了大多数常见场景的图标,支持自定义,支持自定义图片图标等。可自定义颜色、大小。
diff --git a/uni_modules/wu-icon/components/wu-icon/icons.js b/uni_modules/wu-icon/components/wu-icon/icons.js
new file mode 100644
index 0000000..1eb5e4f
--- /dev/null
+++ b/uni_modules/wu-icon/components/wu-icon/icons.js
@@ -0,0 +1,159 @@
+export default {
+ 'wuicon-level': 'e68f',
+ 'wuicon-download': 'e670',
+ 'wuicon-search': 'e632',
+ 'wuicon-reload': 'e627',
+ 'wuicon-scan': 'e631',
+ 'wuicon-calendar': 'e65c',
+ 'wuicon-bag': 'e647',
+ 'wuicon-checkbox-mark': 'e659',
+ 'wuicon-attach': 'e640',
+ 'wuicon-wifi-off': 'e6cc',
+
+ 'wuicon-woman': 'e626',
+ 'wuicon-man': 'e675',
+ 'wuicon-chat': 'e656',
+ 'wuicon-chat-fill': 'e63f',
+ 'wuicon-red-packet': 'e6c3',
+ 'wuicon-folder': 'e694',
+ 'wuicon-order': 'e695',
+ 'wuicon-arrow-up-fill': 'e636',
+ 'wuicon-arrow-down-fill': 'e638',
+ 'wuicon-backspace': 'e64d',
+ 'wuicon-photo': 'e60d',
+ 'wuicon-photo-fill': 'e6b4',
+ 'wuicon-lock': 'e69d',
+ 'wuicon-lock-fill': 'e6a6',
+ 'wuicon-lock-open': 'e68d',
+ 'wuicon-lock-opened-fill': 'e6a1',
+ 'wuicon-home': 'e67b',
+ 'wuicon-home-fill': 'e68e',
+ 'wuicon-star': 'e618',
+ 'wuicon-star-fill': 'e61e',
+ 'wuicon-share': 'e629',
+ 'wuicon-share-fill': 'e6bb',
+ 'wuicon-share-square': 'e6c4',
+ 'wuicon-volume': 'e605',
+ 'wuicon-volume-fill': 'e624',
+ 'wuicon-volume-off': 'e6bd',
+ 'wuicon-volume-off-fill': 'e6c8',
+ 'wuicon-trash': 'e623',
+ 'wuicon-trash-fill': 'e6ce',
+ 'wuicon-shopping-cart': 'e6cb',
+ 'wuicon-shopping-cart-fill': 'e630',
+ 'wuicon-question-circle': 'e622',
+ 'wuicon-question-circle-fill': 'e6bc',
+ 'wuicon-plus': 'e625',
+ 'wuicon-plus-circle': 'e603',
+ 'wuicon-plus-circle-fill': 'e611',
+ 'wuicon-tags': 'e621',
+ 'wuicon-tags-fill': 'e613',
+ 'wuicon-pause': 'e61c',
+ 'wuicon-pause-circle': 'e696',
+ 'wuicon-pause-circle-fill': 'e60c',
+ 'wuicon-play-circle': 'e6af',
+ 'wuicon-play-circle-fill': 'e62a',
+ 'wuicon-map': 'e665',
+ 'wuicon-map-fill': 'e6a8',
+ 'wuicon-phone': 'e6ba',
+ 'wuicon-phone-fill': 'e6ac',
+ 'wuicon-list': 'e690',
+ 'wuicon-list-dot': 'e6a9',
+ 'wuicon-info-circle': 'e69f',
+ 'wuicon-info-circle-fill': 'e6a7',
+ 'wuicon-minus': 'e614',
+ 'wuicon-minus-circle': 'e6a5',
+ 'wuicon-mic': 'e66d',
+ 'wuicon-mic-off': 'e691',
+ 'wuicon-grid': 'e68c',
+ 'wuicon-grid-fill': 'e698',
+ 'wuicon-eye': 'e664',
+ 'wuicon-eye-fill': 'e697',
+ 'wuicon-eye-off': 'e69c',
+ 'wuicon-eye-off-outline': 'e688',
+ 'wuicon-file-text': 'e687',
+ 'wuicon-file-text-fill': 'e67f',
+ 'wuicon-edit-pen': 'e65d',
+ 'wuicon-edit-pen-fill': 'e679',
+ 'wuicon-email': 'e673',
+ 'wuicon-email-fill': 'e683',
+ 'wuicon-checkmark': 'e64a',
+ 'wuicon-checkmark-circle': 'e643',
+ 'wuicon-checkmark-circle-fill': 'e668',
+ 'wuicon-clock': 'e66c',
+ 'wuicon-clock-fill': 'e64b',
+ 'wuicon-close': 'e65a',
+ 'wuicon-close-circle': 'e64e',
+ 'wuicon-close-circle-fill': 'e666',
+ 'wuicon-car': 'e64f',
+ 'wuicon-car-fill': 'e648',
+ 'wuicon-bell': 'e651',
+ 'wuicon-bell-fill': 'e604',
+ 'wuicon-play-left': 'e6bf',
+ 'wuicon-play-right': 'e6b3',
+ 'wuicon-play-left-fill': 'e6ae',
+ 'wuicon-play-right-fill': 'e6ad',
+ 'wuicon-skip-back-left': 'e6c5',
+ 'wuicon-skip-forward-right': 'e61f',
+ 'wuicon-setting': 'e602',
+ 'wuicon-setting-fill': 'e6d0',
+ 'wuicon-more-dot-fill': 'e66f',
+ 'wuicon-more-circle': 'e69e',
+ 'wuicon-more-circle-fill': 'e684',
+ 'wuicon-arrow-upward': 'e641',
+ 'wuicon-arrow-downward': 'e634',
+ 'wuicon-arrow-leftward': 'e63b',
+ 'wuicon-arrow-rightward': 'e644',
+ 'wuicon-arrow-up': 'e633',
+ 'wuicon-arrow-down': 'e63e',
+ 'wuicon-arrow-left': 'e646',
+ 'wuicon-arrow-right': 'e63c',
+ 'wuicon-thumb-up': 'e612',
+ 'wuicon-thumb-up-fill': 'e62c',
+ 'wuicon-thumb-down': 'e60a',
+ 'wuicon-thumb-down-fill': 'e628',
+ 'wuicon-coupon': 'e65f',
+ 'wuicon-coupon-fill': 'e64c',
+ 'wuicon-kefu-ermai': 'e660',
+ 'wuicon-server-fill': 'e610',
+ 'wuicon-server-man': 'e601',
+ 'wuicon-warning': 'e6c1',
+ 'wuicon-warning-fill': 'e6c7',
+ 'wuicon-camera': 'e642',
+ 'wuicon-camera-fill': 'e650',
+ 'wuicon-pushpin': 'e6d1',
+ 'wuicon-pushpin-fill': 'e6b6',
+ 'wuicon-heart': 'e6a2',
+ 'wuicon-heart-fill': 'e68b',
+ 'wuicon-account': 'e63a',
+ 'wuicon-account-fill': 'e653',
+ 'wuicon-integral': 'e693',
+ 'wuicon-integral-fill': 'e6b1',
+ 'wuicon-gift': 'e680',
+ 'wuicon-gift-fill': 'e6b0',
+
+
+ 'wuicon-empty-data': 'e671',
+ 'wuicon-empty-address': 'e68a',
+ 'wuicon-empty-favor': 'e662',
+ 'wuicon-empty-car': 'e656',
+ 'wuicon-empty-order': 'e66b',
+ 'wuicon-empty-list': 'e671',
+ 'wuicon-empty-search': 'e677',
+ 'wuicon-empty-permission': 'e67c',
+ 'wuicon-empty-news': 'e67d',
+ 'wuicon-empty-history': 'e684',
+ 'wuicon-empty-coupon': 'e69b',
+ 'wuicon-empty-page': 'e60e',
+
+ 'wuicon-apple-fill': 'e635',
+ 'wuicon-zhifubao-circle-fill': 'e617',
+ 'wuicon-weixin-circle-fill': 'e6cd',
+ 'wuicon-weixin-fill': 'e620',
+ 'wuicon-qq-fill': 'e608',
+ 'wuicon-qq-circle-fill': 'e6b9',
+ 'wuicon-moments': 'e6a0',
+ 'wuicon-moments-circel-fill': 'e6c2',
+ 'wuicon-twitter': 'e607',
+ 'wuicon-twitter-circle-fill': 'e6cf',
+}
\ No newline at end of file
diff --git a/uni_modules/wu-icon/components/wu-icon/props.js b/uni_modules/wu-icon/components/wu-icon/props.js
new file mode 100644
index 0000000..d35f2c4
--- /dev/null
+++ b/uni_modules/wu-icon/components/wu-icon/props.js
@@ -0,0 +1,90 @@
+export default {
+ props: {
+ // 图标类名
+ name: {
+ type: String,
+ default: ''
+ },
+ // 图标颜色,可接受主题色
+ color: {
+ type: String,
+ default: '#606266'
+ },
+ // 字体大小,单位px
+ size: {
+ type: [String, Number],
+ default: '16px'
+ },
+ // 是否显示粗体
+ bold: {
+ type: Boolean,
+ default: false
+ },
+ // 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
+ index: {
+ type: [String, Number],
+ default: null
+ },
+ // 触摸图标时的类名
+ hoverClass: {
+ type: String,
+ default: ''
+ },
+ // 自定义扩展前缀,方便用户扩展自己的图标库
+ customPrefix: {
+ type: String,
+ default: 'wuicon'
+ },
+ // 图标右边或者下面的文字
+ label: {
+ type: [String, Number],
+ default: ''
+ },
+ // label的位置,只能右边或者下边
+ labelPos: {
+ type: String,
+ default: 'right'
+ },
+ // label的大小
+ labelSize: {
+ type: [String, Number],
+ default: '15px'
+ },
+ // label的颜色
+ labelColor: {
+ type: String,
+ default: '#606266'
+ },
+ // label与图标的距离
+ space: {
+ type: [String, Number],
+ default: '3px'
+ },
+ // 图片的mode
+ imgMode: {
+ type: String,
+ default: ''
+ },
+ // 用于显示图片小图标时,图片的宽度
+ width: {
+ type: [String, Number],
+ default: ''
+ },
+ // 用于显示图片小图标时,图片的高度
+ height: {
+ type: [String, Number],
+ default: ''
+ },
+ // 用于解决某些情况下,让图标垂直居中的用途
+ top: {
+ type: [String, Number],
+ default: 0
+ },
+ // 是否阻止事件传播
+ stop: {
+ type: Boolean,
+ default: false
+ },
+ ...uni.$w?.props?.icon
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-icon/components/wu-icon/wu-icon.vue b/uni_modules/wu-icon/components/wu-icon/wu-icon.vue
new file mode 100644
index 0000000..dea833f
--- /dev/null
+++ b/uni_modules/wu-icon/components/wu-icon/wu-icon.vue
@@ -0,0 +1,225 @@
+
+
+
+ {{ label }}
+
+ {{icon}}
+
+ {{ label }}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/wu-icon/components/wu-icon/wuicons.ttf b/uni_modules/wu-icon/components/wu-icon/wuicons.ttf
new file mode 100644
index 0000000..9aedef8
Binary files /dev/null and b/uni_modules/wu-icon/components/wu-icon/wuicons.ttf differ
diff --git a/uni_modules/wu-icon/package.json b/uni_modules/wu-icon/package.json
new file mode 100644
index 0000000..641288c
--- /dev/null
+++ b/uni_modules/wu-icon/package.json
@@ -0,0 +1,87 @@
+{
+ "id": "wu-icon",
+ "displayName": "wu-icon 图标 全面兼容小程序、nvue、vue2、vue3等多端",
+ "version": "1.0.4",
+ "description": "基于字体的图标集,包含了大多数常见场景的图标,支持自定义,支持自定义图片图标等。可自定义颜色、大小。",
+ "keywords": [
+ "wu-ui",
+ "图标",
+ "wu-icon",
+ "文字图标"
+ ],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.4.15"
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [
+ "wu-ui-tools"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y",
+ "alipay": "n"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y",
+ "钉钉": "u",
+ "快手": "u",
+ "飞书": "u",
+ "京东": "u"
+ },
+ "快应用": {
+ "华为": "u",
+ "联盟": "u"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-icon/readme.md b/uni_modules/wu-icon/readme.md
new file mode 100644
index 0000000..6ab6263
--- /dev/null
+++ b/uni_modules/wu-icon/readme.md
@@ -0,0 +1,10 @@
+## wu-icon 图标库
+
+> **组件名:wu-icon**
+
+基于字体的图标集,包含了大多数常见场景的图标,支持自定义(包括nvue)文字与图片图标等。
+
+## 查看文档
+
+## [更多插件,请关注wu-ui组件库](https://ext.dcloud.net.cn/plugin?name=wuui) (请不要 下载插件ZIP)
+**如使用过程中有任何问题,或者您对wu-ui有一些好的建议。
欢迎加入 [wu-ui 交流群](https://wuui.cn/zh-CN/components/qqFeedBack.html)**
\ No newline at end of file
diff --git a/uni_modules/wu-safe-bottom/changelog.md b/uni_modules/wu-safe-bottom/changelog.md
new file mode 100644
index 0000000..e67564d
--- /dev/null
+++ b/uni_modules/wu-safe-bottom/changelog.md
@@ -0,0 +1,6 @@
+## 1.0.2(2024-05-08)
+更新域名
+## 1.0.1(2023-09-11)
+优化底部安全距离计算方法
+## 1.0.0(2023-09-01)
+主要是针对IPhone X等一些底部带指示条的机型,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。
diff --git a/uni_modules/wu-safe-bottom/components/wu-safe-bottom/props.js b/uni_modules/wu-safe-bottom/components/wu-safe-bottom/props.js
new file mode 100644
index 0000000..8bfc9f4
--- /dev/null
+++ b/uni_modules/wu-safe-bottom/components/wu-safe-bottom/props.js
@@ -0,0 +1,5 @@
+export default {
+ props: {
+ ...uni.$w?.props?.safeBottom
+ }
+}
diff --git a/uni_modules/wu-safe-bottom/components/wu-safe-bottom/wu-safe-bottom.vue b/uni_modules/wu-safe-bottom/components/wu-safe-bottom/wu-safe-bottom.vue
new file mode 100644
index 0000000..d17e30c
--- /dev/null
+++ b/uni_modules/wu-safe-bottom/components/wu-safe-bottom/wu-safe-bottom.vue
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
diff --git a/uni_modules/wu-safe-bottom/package.json b/uni_modules/wu-safe-bottom/package.json
new file mode 100644
index 0000000..d960a01
--- /dev/null
+++ b/uni_modules/wu-safe-bottom/package.json
@@ -0,0 +1,88 @@
+{
+ "id": "wu-safe-bottom",
+ "displayName": "wu-safe-bottom底部安全区 全端兼容 无论平台 一致体验",
+ "version": "1.0.2",
+ "description": "针对一些底部带指示条的机型,操作区域与页面底部重合,容易误操作,因此本插件对这些机型进行底部安全区适配",
+ "keywords": [
+ "wu-ui",
+ "wuui",
+ "wu-safe-bottom",
+ "safe-bottom",
+ "底部安全区"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.4.15"
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [
+ "wu-ui-tools"
+ ],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y",
+ "alipay": "n"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-safe-bottom/readme.md b/uni_modules/wu-safe-bottom/readme.md
new file mode 100644
index 0000000..28ee5a7
--- /dev/null
+++ b/uni_modules/wu-safe-bottom/readme.md
@@ -0,0 +1,16 @@
+## wu-safe-bottom 底部安全区
+
+> **组件名:wu-safe-bottom**
+
+这个适配,主要是针对IPhone X等一些底部带指示条的机型,指示条的操作区域与页面底部存在重合,容易导致用户误操作,因此我们需要针对这些机型进行底部安全区适配。
+
+## [查看文档](https://wuui.cn/zh-CN/components/safeAreaInset.html)
+
+## [更多组件, 请查看 `wu-ui` 组件库](https://ext.dcloud.net.cn/plugin?name=wu--ui)
+(请勿下载插件zip)
+
+
+
+
+
+**如使用过程中有任何问题,或者您对wu-ui有一些好的建议。
欢迎加入 [wu-ui 交流群](https://wuui.cn/zh-CN/components/qqFeedBack.html)**
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/changelog.md b/uni_modules/wu-ui-tools/changelog.md
new file mode 100644
index 0000000..6960de4
--- /dev/null
+++ b/uni_modules/wu-ui-tools/changelog.md
@@ -0,0 +1,22 @@
+## 1.1.0(2023-09-13)
+更新版本
+## 1.0.9(2023-09-08)
+修复Color方法引入路径错误
+## 1.0.8(2023-09-05)
+Color不在使用npm包,改为本地方法
+## 1.0.7(2023-09-03)
+修复引入错误
+## 1.0.6(2023-09-03)
+发布1.0.6版本
+## 1.0.5(2023-08-30)
+修复api部分未导入
+## 1.0.4(2023-08-21)
+修复Color API引入错误
+## 1.0.3(2023-08-18)
+新增颜色API,支持任意颜色格式转换,颜色亮度调节、颜色饱和度调节、亮度获取、颜色是否深/亮等
+## 1.0.2(2023-08-16)
+mixin交互节点信息根边距设置
+## 1.0.1(2023-08-16)
+mixin更新节点交互信息查询
+## 1.0.0(2023-08-01)
+wu-ui-tools 工具库 全面兼容小程序、nvue、vue2、vue3等多端
diff --git a/uni_modules/wu-ui-tools/components/wu-ui-tools/wu-ui-tools.vue b/uni_modules/wu-ui-tools/components/wu-ui-tools/wu-ui-tools.vue
new file mode 100644
index 0000000..baf45e9
--- /dev/null
+++ b/uni_modules/wu-ui-tools/components/wu-ui-tools/wu-ui-tools.vue
@@ -0,0 +1,6 @@
+
+
+
+
diff --git a/uni_modules/wu-ui-tools/index.js b/uni_modules/wu-ui-tools/index.js
new file mode 100644
index 0000000..00cef45
--- /dev/null
+++ b/uni_modules/wu-ui-tools/index.js
@@ -0,0 +1,73 @@
+// 全局挂载引入http相关请求拦截插件
+import Request from './libs/luch-request'
+
+// 引入全局mixin
+import mixin from './libs/mixin/mixin.js'
+// 小程序特有的mixin
+import mpMixin from './libs/mixin/mpMixin.js'
+// #ifdef MP
+import mpShare from './libs/mixin/mpShare.js'
+// #endif
+
+// 路由封装
+import route from './libs/util/route.js'
+// 公共工具函数
+import * as index from './libs/function/index.js'
+// 防抖方法
+import debounce from './libs/function/debounce.js'
+// 节流方法
+import throttle from './libs/function/throttle.js'
+// 规则检验
+import * as test from './libs/function/test.js'
+
+// 配置信息
+import config from './libs/config/config.js'
+// 平台
+import platform from './libs/function/platform'
+
+import Color from './libs/function/color/index.js'
+
+const $w = {
+ ...index,
+ route,
+ config,
+ test,
+ throttle,
+ date: index.timeFormat, // 另名date
+ Color,
+ http: new Request(),
+ debounce,
+ throttle,
+ platform,
+ mixin,
+ mpMixin
+}
+uni.$w = $w;
+const install = (Vue,options={}) => {
+ // #ifndef APP-NVUE
+ Vue.mixin(mixin);
+ // #ifdef MP
+ if(options.mpShare){
+ Vue.mixin(mpShare);
+ }
+ // #endif
+ // #endif
+ // #ifdef VUE2
+ // 时间格式化,同时两个名称,date和timeFormat
+ Vue.filter('timeFormat', (timestamp, format) => uni.$w.timeFormat(timestamp, format));
+ Vue.filter('date', (timestamp, format) => uni.$w.timeFormat(timestamp, format));
+ // 将多久以前的方法,注入到全局过滤器
+ Vue.filter('timeFrom', (timestamp, format) => uni.$w.timeFrom(timestamp, format));
+ // 同时挂载到uni和Vue.prototype中
+ // #ifndef APP-NVUE
+ // 只有vue,挂载到Vue.prototype才有意义,因为nvue中全局Vue.prototype和Vue.mixin是无效的
+ Vue.prototype.$w = $w;
+ // #endif
+ // #endif
+ // #ifdef VUE3
+ Vue.config.globalProperties.$w = $w;
+ // #endif
+}
+export default {
+ install
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/index.scss b/uni_modules/wu-ui-tools/index.scss
new file mode 100644
index 0000000..8d05b8d
--- /dev/null
+++ b/uni_modules/wu-ui-tools/index.scss
@@ -0,0 +1,7 @@
+// 引入公共基础类
+@import "./libs/css/common.scss";
+
+// 非nvue的样式
+/* #ifndef APP-NVUE */
+@import "./libs/css/vue.scss";
+/* #endif */
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/config/config.js b/uni_modules/wu-ui-tools/libs/config/config.js
new file mode 100644
index 0000000..02ab3cf
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/config/config.js
@@ -0,0 +1,34 @@
+// 此版本发布于2023-09-13
+const version = '1.0.9'
+
+// 开发环境才提示,生产环境不会提示
+if (process.env.NODE_ENV === 'development') {
+ console.log(`\n %c wuui V${version} https://wuui.geeks.ink/ \n\n`, 'color: #ffffff; background: #3c9cff; padding:5px 0; border-radius: 5px;');
+}
+
+export default {
+ v: version,
+ version,
+ // 主题名称
+ type: [
+ 'primary',
+ 'success',
+ 'info',
+ 'error',
+ 'warning'
+ ],
+ // 颜色部分,本来可以通过scss的:export导出供js使用,但是奈何nvue不支持
+ color: {
+ 'wu-primary': '#2979ff',
+ 'wu-warning': '#ff9900',
+ 'wu-success': '#19be6b',
+ 'wu-error': '#fa3534',
+ 'wu-info': '#909399',
+ 'wu-main-color': '#303133',
+ 'wu-content-color': '#606266',
+ 'wu-tips-color': '#909399',
+ 'wu-light-color': '#c0c4cc'
+ },
+ // 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
+ unit: 'px'
+}
diff --git a/uni_modules/wu-ui-tools/libs/css/color.scss b/uni_modules/wu-ui-tools/libs/css/color.scss
new file mode 100644
index 0000000..6f98927
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/css/color.scss
@@ -0,0 +1,32 @@
+$wu-main-color: #303133 !default;
+$wu-content-color: #606266 !default;
+$wu-tips-color: #909193 !default;
+$wu-light-color: #c0c4cc !default;
+$wu-border-color: #dadbde !default;
+$wu-bg-color: #f3f4f6 !default;
+$wu-disabled-color: #c8c9cc !default;
+
+$wu-primary: #3c9cff !default;
+$wu-primary-dark: #398ade !default;
+$wu-primary-disabled: #9acafc !default;
+$wu-primary-light: #ecf5ff !default;
+
+$wu-warning: #f9ae3d !default;
+$wu-warning-dark: #f1a532 !default;
+$wu-warning-disabled: #f9d39b !default;
+$wu-warning-light: #fdf6ec !default;
+
+$wu-success: #5ac725 !default;
+$wu-success-dark: #53c21d !default;
+$wu-success-disabled: #a9e08f !default;
+$wu-success-light: #f5fff0;
+
+$wu-error: #f56c6c !default;
+$wu-error-dark: #e45656 !default;
+$wu-error-disabled: #f7b2b2 !default;
+$wu-error-light: #fef0f0 !default;
+
+$wu-info: #909399 !default;
+$wu-info-dark: #767a82 !default;
+$wu-info-disabled: #c4c6c9 !default;
+$wu-info-light: #f4f4f5 !default;
diff --git a/uni_modules/wu-ui-tools/libs/css/common.scss b/uni_modules/wu-ui-tools/libs/css/common.scss
new file mode 100644
index 0000000..0234f0f
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/css/common.scss
@@ -0,0 +1,100 @@
+// 超出行数,自动显示行尾省略号,最多5行
+// 来自wuui的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】
+@for $i from 1 through 5 {
+ .wu-line-#{$i} {
+ /* #ifdef APP-NVUE */
+ // nvue下,可以直接使用lines属性,这是weex特有样式
+ lines: $i;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ flex: 1;
+ /* #endif */
+
+ /* #ifndef APP-NVUE */
+ // vue下,单行和多行显示省略号需要单独处理
+ @if $i == '1' {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ } @else {
+ display: -webkit-box!important;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ -webkit-line-clamp: $i;
+ -webkit-box-orient: vertical!important;
+ }
+ /* #endif */
+ }
+}
+$wu-bordercolor: #dadbde;
+@if variable-exists(wu-border-color) {
+ $wu-bordercolor: $wu-border-color;
+}
+
+// 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时,
+// App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效
+// 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important
+// 移动端兼容性较好,直接使用0.5px去实现细边框,不使用伪元素形式实现
+.wu-border {
+ border-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-style: solid;
+}
+
+.wu-border-top {
+ border-top-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-top-style: solid;
+}
+
+.wu-border-left {
+ border-left-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-left-style: solid;
+}
+
+.wu-border-right {
+ border-right-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-right-style: solid;
+}
+
+.wu-border-bottom {
+ border-bottom-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-bottom-style: solid;
+}
+
+.wu-border-top-bottom {
+ border-top-width: 0.5px!important;
+ border-bottom-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-top-style: solid;
+ border-bottom-style: solid;
+}
+
+// 去除button的所有默认样式,让其表现跟普通的view、text元素一样
+.wu-reset-button {
+ padding: 0;
+ background-color: transparent;
+ /* #ifndef APP-PLUS */
+ font-size: inherit;
+ line-height: inherit;
+ color: inherit;
+ /* #endif */
+ /* #ifdef APP-NVUE */
+ border-width: 0;
+ /* #endif */
+}
+
+/* #ifndef APP-NVUE */
+.wu-reset-button::after {
+ border: none;
+}
+/* #endif */
+
+.wu-hover-class {
+ opacity: 0.7;
+}
+
diff --git a/uni_modules/wu-ui-tools/libs/css/components.scss b/uni_modules/wu-ui-tools/libs/css/components.scss
new file mode 100644
index 0000000..d56ae50
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/css/components.scss
@@ -0,0 +1,23 @@
+@mixin flex($direction: row) {
+ /* #ifndef APP-NVUE */
+ display: flex;
+ /* #endif */
+ flex-direction: $direction;
+}
+
+/* #ifndef APP-NVUE */
+// 由于wuui是基于nvue环境进行开发的,此环境中普通元素默认为flex-direction: column;
+// 所以在非nvue中,需要对元素进行重置为flex-direction: column; 否则可能会表现异常
+$wuui-nvue-style: true !default;
+@if $wuui-nvue-style == true {
+ view, scroll-view, swiper-item {
+ display: flex;
+ flex-direction: column;
+ flex-shrink: 0;
+ flex-grow: 0;
+ flex-basis: auto;
+ align-items: stretch;
+ align-content: flex-start;
+ }
+}
+/* #endif */
diff --git a/uni_modules/wu-ui-tools/libs/css/variable.scss b/uni_modules/wu-ui-tools/libs/css/variable.scss
new file mode 100644
index 0000000..35cbdfe
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/css/variable.scss
@@ -0,0 +1,111 @@
+// 超出行数,自动显示行尾省略号,最多5行
+// 来自uvui的温馨提示:当您在控制台看到此报错,说明需要在App.vue的style标签加上【lang="scss"】
+@if variable-exists(show-lines) {
+ @for $i from 1 through 5 {
+ .wu-line-#{$i} {
+ /* #ifdef APP-NVUE */
+ // nvue下,可以直接使用lines属性,这是weex特有样式
+ lines: $i;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ flex: 1;
+ /* #endif */
+
+ /* #ifndef APP-NVUE */
+ // vue下,单行和多行显示省略号需要单独处理
+ @if $i == '1' {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ } @else {
+ display: -webkit-box!important;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ word-break: break-all;
+ -webkit-line-clamp: $i;
+ -webkit-box-orient: vertical!important;
+ }
+ /* #endif */
+ }
+ }
+}
+@if variable-exists(show-border) {
+ $wu-bordercolor: #dadbde;
+ @if variable-exists(wu-border-color) {
+ $wu-bordercolor: $wu-border-color;
+ }
+ // 此处加上!important并非随意乱用,而是因为目前*.nvue页面编译到H5时,
+ // App.vue的样式会被uni-app的view元素的自带border属性覆盖,导致无效
+ // 综上,这是uni-app的缺陷导致我们为了多端兼容,而必须要加上!important
+ // 移动端兼容性较好,直接使用0.5px去实现细边框,不使用伪元素形式实现
+ @if variable-exists(show-border-surround) {
+ .wu-border {
+ border-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-style: solid;
+ }
+ }
+ @if variable-exists(show-border-top) {
+ .wu-border-top {
+ border-top-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-top-style: solid;
+ }
+ }
+ @if variable-exists(show-border-left) {
+ .wu-border-left {
+ border-left-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-left-style: solid;
+ }
+ }
+ @if variable-exists(show-border-right) {
+ .wu-border-right {
+ border-right-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-right-style: solid;
+ }
+ }
+ @if variable-exists(show-border-bottom) {
+ .wu-border-bottom {
+ border-bottom-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-bottom-style: solid;
+ }
+ }
+ @if variable-exists(show-border-top-bottom) {
+ .wu-border-top-bottom {
+ border-top-width: 0.5px!important;
+ border-bottom-width: 0.5px!important;
+ border-color: $wu-bordercolor!important;
+ border-top-style: solid;
+ border-bottom-style: solid;
+ }
+ }
+}
+@if variable-exists(show-reset-button) {
+ // 去除button的所有默认样式,让其表现跟普通的view、text元素一样
+ .wu-reset-button {
+ padding: 0;
+ background-color: transparent;
+ /* #ifndef APP-PLUS */
+ font-size: inherit;
+ line-height: inherit;
+ color: inherit;
+ /* #endif */
+ /* #ifdef APP-NVUE */
+ border-width: 0;
+ /* #endif */
+ }
+
+ /* #ifndef APP-NVUE */
+ .wu-reset-button::after {
+ border: none;
+ }
+ /* #endif */
+}
+@if variable-exists(show-hover) {
+ .wu-hover-class {
+ opacity: 0.7;
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/css/vue.scss b/uni_modules/wu-ui-tools/libs/css/vue.scss
new file mode 100644
index 0000000..a5b02c9
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/css/vue.scss
@@ -0,0 +1,40 @@
+// 历遍生成4个方向的底部安全区
+@each $d in top, right, bottom, left {
+ .wu-safe-area-inset-#{$d} {
+ padding-#{$d}: 0;
+ padding-#{$d}: constant(safe-area-inset-#{$d});
+ padding-#{$d}: env(safe-area-inset-#{$d});
+ }
+}
+
+//提升H5端uni.toast()的层级,避免被wuui的modal等遮盖
+/* #ifdef H5 */
+uni-toast {
+ z-index: 10090;
+}
+uni-toast .uni-toast {
+ z-index: 10090;
+}
+/* #endif */
+
+// 隐藏scroll-view的滚动条
+::-webkit-scrollbar {
+ display: none;
+ width: 0 !important;
+ height: 0 !important;
+ -webkit-appearance: none;
+ background: transparent;
+}
+
+$wuui-nvue-style: true !default;
+@if $wuui-nvue-style == false {
+ view, scroll-view, swiper-item {
+ display: flex;
+ flex-direction: column;
+ flex-shrink: 0;
+ flex-grow: 0;
+ flex-basis: auto;
+ align-items: stretch;
+ align-content: flex-start;
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/CHANGELOG.md b/uni_modules/wu-ui-tools/libs/function/color/color-convert/CHANGELOG.md
new file mode 100644
index 0000000..0a7bce4
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/CHANGELOG.md
@@ -0,0 +1,54 @@
+# 1.0.0 - 2016-01-07
+
+- Removed: unused speed test
+- Added: Automatic routing between previously unsupported conversions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `xxx2xxx()` and `xxx2xxxRaw()` functions
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Removed: `convert()` class
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: all functions to lookup dictionary
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Changed: `ansi` to `ansi256`
+([#27](https://github.com/Qix-/color-convert/pull/27))
+- Fixed: argument grouping for functions requiring only one argument
+([#27](https://github.com/Qix-/color-convert/pull/27))
+
+# 0.6.0 - 2015-07-23
+
+- Added: methods to handle
+[ANSI](https://en.wikipedia.org/wiki/ANSI_escape_code#Colors) 16/256 colors:
+ - rgb2ansi16
+ - rgb2ansi
+ - hsl2ansi16
+ - hsl2ansi
+ - hsv2ansi16
+ - hsv2ansi
+ - hwb2ansi16
+ - hwb2ansi
+ - cmyk2ansi16
+ - cmyk2ansi
+ - keyword2ansi16
+ - keyword2ansi
+ - ansi162rgb
+ - ansi162hsl
+ - ansi162hsv
+ - ansi162hwb
+ - ansi162cmyk
+ - ansi162keyword
+ - ansi2rgb
+ - ansi2hsl
+ - ansi2hsv
+ - ansi2hwb
+ - ansi2cmyk
+ - ansi2keyword
+([#18](https://github.com/harthur/color-convert/pull/18))
+
+# 0.5.3 - 2015-06-02
+
+- Fixed: hsl2hsv does not return `NaN` anymore when using `[0,0,0]`
+([#15](https://github.com/harthur/color-convert/issues/15))
+
+---
+
+Check out commit logs for older releases
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/LICENSE b/uni_modules/wu-ui-tools/libs/function/color/color-convert/LICENSE
new file mode 100644
index 0000000..5b4c386
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2011-2016 Heather Arthur
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/README.md b/uni_modules/wu-ui-tools/libs/function/color/color-convert/README.md
new file mode 100644
index 0000000..d4b08fc
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/README.md
@@ -0,0 +1,68 @@
+# color-convert
+
+[](https://travis-ci.org/Qix-/color-convert)
+
+Color-convert is a color conversion library for JavaScript and node.
+It converts all ways between `rgb`, `hsl`, `hsv`, `hwb`, `cmyk`, `ansi`, `ansi16`, `hex` strings, and CSS `keyword`s (will round to closest):
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hsl(140, 200, 100); // [96, 48, 59]
+convert.keyword.rgb('blue'); // [0, 0, 255]
+
+var rgbChannels = convert.rgb.channels; // 3
+var cmykChannels = convert.cmyk.channels; // 4
+var ansiChannels = convert.ansi16.channels; // 1
+```
+
+# Install
+
+```console
+$ npm install color-convert
+```
+
+# API
+
+Simply get the property of the _from_ and _to_ conversion that you're looking for.
+
+All functions have a rounded and unrounded variant. By default, return values are rounded. To get the unrounded (raw) results, simply tack on `.raw` to the function.
+
+All 'from' functions have a hidden property called `.channels` that indicates the number of channels the function expects (not including alpha).
+
+```js
+var convert = require('color-convert');
+
+// Hex to LAB
+convert.hex.lab('DEADBF'); // [ 76, 21, -2 ]
+convert.hex.lab.raw('DEADBF'); // [ 75.56213190997677, 20.653827952644754, -2.290532499330533 ]
+
+// RGB to CMYK
+convert.rgb.cmyk(167, 255, 4); // [ 35, 0, 98, 0 ]
+convert.rgb.cmyk.raw(167, 255, 4); // [ 34.509803921568626, 0, 98.43137254901961, 0 ]
+```
+
+### Arrays
+All functions that accept multiple arguments also support passing an array.
+
+Note that this does **not** apply to functions that convert from a color that only requires one value (e.g. `keyword`, `ansi256`, `hex`, etc.)
+
+```js
+var convert = require('color-convert');
+
+convert.rgb.hex(123, 45, 67); // '7B2D43'
+convert.rgb.hex([123, 45, 67]); // '7B2D43'
+```
+
+## Routing
+
+Conversions that don't have an _explicitly_ defined conversion (in [conversions.js](conversions.js)), but can be converted by means of sub-conversions (e.g. XYZ -> **RGB** -> CMYK), are automatically routed together. This allows just about any color model supported by `color-convert` to be converted to any other model, so long as a sub-conversion path exists. This is also true for conversions requiring more than one step in between (e.g. LCH -> **LAB** -> **XYZ** -> **RGB** -> Hex).
+
+Keep in mind that extensive conversions _may_ result in a loss of precision, and exist only to be complete. For a list of "direct" (single-step) conversions, see [conversions.js](conversions.js).
+
+# Contribute
+
+If there is a new model you would like to support, or want to add a direct conversion between two existing models, please send us a pull request.
+
+# License
+Copyright © 2011-2016, Heather Arthur and Josh Junon. Licensed under the [MIT License](LICENSE).
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/conversions.js b/uni_modules/wu-ui-tools/libs/function/color/color-convert/conversions.js
new file mode 100644
index 0000000..04b49dd
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/conversions.js
@@ -0,0 +1,839 @@
+/* MIT license */
+/* eslint-disable no-mixed-operators */
+import cssKeywords from '../color-name';
+
+// NOTE: conversions should only return primitive values (i.e. arrays, or
+// values that give correct `typeof` results).
+// do not use box values types (i.e. Number(), String(), etc.)
+
+const reverseKeywords = {};
+for (const key of Object.keys(cssKeywords)) {
+ reverseKeywords[cssKeywords[key]] = key;
+}
+
+const convert = {
+ rgb: {channels: 3, labels: 'rgb'},
+ hsl: {channels: 3, labels: 'hsl'},
+ hsv: {channels: 3, labels: 'hsv'},
+ hwb: {channels: 3, labels: 'hwb'},
+ cmyk: {channels: 4, labels: 'cmyk'},
+ xyz: {channels: 3, labels: 'xyz'},
+ lab: {channels: 3, labels: 'lab'},
+ lch: {channels: 3, labels: 'lch'},
+ hex: {channels: 1, labels: ['hex']},
+ keyword: {channels: 1, labels: ['keyword']},
+ ansi16: {channels: 1, labels: ['ansi16']},
+ ansi256: {channels: 1, labels: ['ansi256']},
+ hcg: {channels: 3, labels: ['h', 'c', 'g']},
+ apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
+ gray: {channels: 1, labels: ['gray']}
+};
+
+export default convert;
+
+// Hide .channels and .labels properties
+for (const model of Object.keys(convert)) {
+ if (!('channels' in convert[model])) {
+ throw new Error('missing channels property: ' + model);
+ }
+
+ if (!('labels' in convert[model])) {
+ throw new Error('missing channel labels property: ' + model);
+ }
+
+ if (convert[model].labels.length !== convert[model].channels) {
+ throw new Error('channel and label counts mismatch: ' + model);
+ }
+
+ const {channels, labels} = convert[model];
+ delete convert[model].channels;
+ delete convert[model].labels;
+ Object.defineProperty(convert[model], 'channels', {value: channels});
+ Object.defineProperty(convert[model], 'labels', {value: labels});
+}
+
+convert.rgb.hsl = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const min = Math.min(r, g, b);
+ const max = Math.max(r, g, b);
+ const delta = max - min;
+ let h;
+ let s;
+
+ if (max === min) {
+ h = 0;
+ } else if (r === max) {
+ h = (g - b) / delta;
+ } else if (g === max) {
+ h = 2 + (b - r) / delta;
+ } else if (b === max) {
+ h = 4 + (r - g) / delta;
+ }
+
+ h = Math.min(h * 60, 360);
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ const l = (min + max) / 2;
+
+ if (max === min) {
+ s = 0;
+ } else if (l <= 0.5) {
+ s = delta / (max + min);
+ } else {
+ s = delta / (2 - max - min);
+ }
+
+ return [h, s * 100, l * 100];
+};
+
+convert.rgb.hsv = function (rgb) {
+ let rdif;
+ let gdif;
+ let bdif;
+ let h;
+ let s;
+
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const v = Math.max(r, g, b);
+ const diff = v - Math.min(r, g, b);
+ const diffc = function (c) {
+ return (v - c) / 6 / diff + 1 / 2;
+ };
+
+ if (diff === 0) {
+ h = 0;
+ s = 0;
+ } else {
+ s = diff / v;
+ rdif = diffc(r);
+ gdif = diffc(g);
+ bdif = diffc(b);
+
+ if (r === v) {
+ h = bdif - gdif;
+ } else if (g === v) {
+ h = (1 / 3) + rdif - bdif;
+ } else if (b === v) {
+ h = (2 / 3) + gdif - rdif;
+ }
+
+ if (h < 0) {
+ h += 1;
+ } else if (h > 1) {
+ h -= 1;
+ }
+ }
+
+ return [
+ h * 360,
+ s * 100,
+ v * 100
+ ];
+};
+
+convert.rgb.hwb = function (rgb) {
+ const r = rgb[0];
+ const g = rgb[1];
+ let b = rgb[2];
+ const h = convert.rgb.hsl(rgb)[0];
+ const w = 1 / 255 * Math.min(r, Math.min(g, b));
+
+ b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
+
+ return [h, w * 100, b * 100];
+};
+
+convert.rgb.cmyk = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+
+ const k = Math.min(1 - r, 1 - g, 1 - b);
+ const c = (1 - r - k) / (1 - k) || 0;
+ const m = (1 - g - k) / (1 - k) || 0;
+ const y = (1 - b - k) / (1 - k) || 0;
+
+ return [c * 100, m * 100, y * 100, k * 100];
+};
+
+function comparativeDistance(x, y) {
+ /*
+ See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
+ */
+ return (
+ ((x[0] - y[0]) ** 2) +
+ ((x[1] - y[1]) ** 2) +
+ ((x[2] - y[2]) ** 2)
+ );
+}
+
+convert.rgb.keyword = function (rgb) {
+ const reversed = reverseKeywords[rgb];
+ if (reversed) {
+ return reversed;
+ }
+
+ let currentClosestDistance = Infinity;
+ let currentClosestKeyword;
+
+ for (const keyword of Object.keys(cssKeywords)) {
+ const value = cssKeywords[keyword];
+
+ // Compute comparative distance
+ const distance = comparativeDistance(rgb, value);
+
+ // Check if its less, if so set as closest
+ if (distance < currentClosestDistance) {
+ currentClosestDistance = distance;
+ currentClosestKeyword = keyword;
+ }
+ }
+
+ return currentClosestKeyword;
+};
+
+convert.keyword.rgb = function (keyword) {
+ return cssKeywords[keyword];
+};
+
+convert.rgb.xyz = function (rgb) {
+ let r = rgb[0] / 255;
+ let g = rgb[1] / 255;
+ let b = rgb[2] / 255;
+
+ // Assume sRGB
+ r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);
+ g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);
+ b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);
+
+ const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
+ const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
+ const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
+
+ return [x * 100, y * 100, z * 100];
+};
+
+convert.rgb.lab = function (rgb) {
+ const xyz = convert.rgb.xyz(rgb);
+ let x = xyz[0];
+ let y = xyz[1];
+ let z = xyz[2];
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
+
+ const l = (116 * y) - 16;
+ const a = 500 * (x - y);
+ const b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.hsl.rgb = function (hsl) {
+ const h = hsl[0] / 360;
+ const s = hsl[1] / 100;
+ const l = hsl[2] / 100;
+ let t2;
+ let t3;
+ let val;
+
+ if (s === 0) {
+ val = l * 255;
+ return [val, val, val];
+ }
+
+ if (l < 0.5) {
+ t2 = l * (1 + s);
+ } else {
+ t2 = l + s - l * s;
+ }
+
+ const t1 = 2 * l - t2;
+
+ const rgb = [0, 0, 0];
+ for (let i = 0; i < 3; i++) {
+ t3 = h + 1 / 3 * -(i - 1);
+ if (t3 < 0) {
+ t3++;
+ }
+
+ if (t3 > 1) {
+ t3--;
+ }
+
+ if (6 * t3 < 1) {
+ val = t1 + (t2 - t1) * 6 * t3;
+ } else if (2 * t3 < 1) {
+ val = t2;
+ } else if (3 * t3 < 2) {
+ val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
+ } else {
+ val = t1;
+ }
+
+ rgb[i] = val * 255;
+ }
+
+ return rgb;
+};
+
+convert.hsl.hsv = function (hsl) {
+ const h = hsl[0];
+ let s = hsl[1] / 100;
+ let l = hsl[2] / 100;
+ let smin = s;
+ const lmin = Math.max(l, 0.01);
+
+ l *= 2;
+ s *= (l <= 1) ? l : 2 - l;
+ smin *= lmin <= 1 ? lmin : 2 - lmin;
+ const v = (l + s) / 2;
+ const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
+
+ return [h, sv * 100, v * 100];
+};
+
+convert.hsv.rgb = function (hsv) {
+ const h = hsv[0] / 60;
+ const s = hsv[1] / 100;
+ let v = hsv[2] / 100;
+ const hi = Math.floor(h) % 6;
+
+ const f = h - Math.floor(h);
+ const p = 255 * v * (1 - s);
+ const q = 255 * v * (1 - (s * f));
+ const t = 255 * v * (1 - (s * (1 - f)));
+ v *= 255;
+
+ switch (hi) {
+ case 0:
+ return [v, t, p];
+ case 1:
+ return [q, v, p];
+ case 2:
+ return [p, v, t];
+ case 3:
+ return [p, q, v];
+ case 4:
+ return [t, p, v];
+ case 5:
+ return [v, p, q];
+ }
+};
+
+convert.hsv.hsl = function (hsv) {
+ const h = hsv[0];
+ const s = hsv[1] / 100;
+ const v = hsv[2] / 100;
+ const vmin = Math.max(v, 0.01);
+ let sl;
+ let l;
+
+ l = (2 - s) * v;
+ const lmin = (2 - s) * vmin;
+ sl = s * vmin;
+ sl /= (lmin <= 1) ? lmin : 2 - lmin;
+ sl = sl || 0;
+ l /= 2;
+
+ return [h, sl * 100, l * 100];
+};
+
+// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
+convert.hwb.rgb = function (hwb) {
+ const h = hwb[0] / 360;
+ let wh = hwb[1] / 100;
+ let bl = hwb[2] / 100;
+ const ratio = wh + bl;
+ let f;
+
+ // Wh + bl cant be > 1
+ if (ratio > 1) {
+ wh /= ratio;
+ bl /= ratio;
+ }
+
+ const i = Math.floor(6 * h);
+ const v = 1 - bl;
+ f = 6 * h - i;
+
+ if ((i & 0x01) !== 0) {
+ f = 1 - f;
+ }
+
+ const n = wh + f * (v - wh); // Linear interpolation
+
+ let r;
+ let g;
+ let b;
+ /* eslint-disable max-statements-per-line,no-multi-spaces */
+ switch (i) {
+ default:
+ case 6:
+ case 0: r = v; g = n; b = wh; break;
+ case 1: r = n; g = v; b = wh; break;
+ case 2: r = wh; g = v; b = n; break;
+ case 3: r = wh; g = n; b = v; break;
+ case 4: r = n; g = wh; b = v; break;
+ case 5: r = v; g = wh; b = n; break;
+ }
+ /* eslint-enable max-statements-per-line,no-multi-spaces */
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.cmyk.rgb = function (cmyk) {
+ const c = cmyk[0] / 100;
+ const m = cmyk[1] / 100;
+ const y = cmyk[2] / 100;
+ const k = cmyk[3] / 100;
+
+ const r = 1 - Math.min(1, c * (1 - k) + k);
+ const g = 1 - Math.min(1, m * (1 - k) + k);
+ const b = 1 - Math.min(1, y * (1 - k) + k);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.rgb = function (xyz) {
+ const x = xyz[0] / 100;
+ const y = xyz[1] / 100;
+ const z = xyz[2] / 100;
+ let r;
+ let g;
+ let b;
+
+ r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
+ g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
+ b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
+
+ // Assume sRGB
+ r = r > 0.0031308
+ ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)
+ : r * 12.92;
+
+ g = g > 0.0031308
+ ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)
+ : g * 12.92;
+
+ b = b > 0.0031308
+ ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)
+ : b * 12.92;
+
+ r = Math.min(Math.max(0, r), 1);
+ g = Math.min(Math.max(0, g), 1);
+ b = Math.min(Math.max(0, b), 1);
+
+ return [r * 255, g * 255, b * 255];
+};
+
+convert.xyz.lab = function (xyz) {
+ let x = xyz[0];
+ let y = xyz[1];
+ let z = xyz[2];
+
+ x /= 95.047;
+ y /= 100;
+ z /= 108.883;
+
+ x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);
+
+ const l = (116 * y) - 16;
+ const a = 500 * (x - y);
+ const b = 200 * (y - z);
+
+ return [l, a, b];
+};
+
+convert.lab.xyz = function (lab) {
+ const l = lab[0];
+ const a = lab[1];
+ const b = lab[2];
+ let x;
+ let y;
+ let z;
+
+ y = (l + 16) / 116;
+ x = a / 500 + y;
+ z = y - b / 200;
+
+ const y2 = y ** 3;
+ const x2 = x ** 3;
+ const z2 = z ** 3;
+ y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
+ x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
+ z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
+
+ x *= 95.047;
+ y *= 100;
+ z *= 108.883;
+
+ return [x, y, z];
+};
+
+convert.lab.lch = function (lab) {
+ const l = lab[0];
+ const a = lab[1];
+ const b = lab[2];
+ let h;
+
+ const hr = Math.atan2(b, a);
+ h = hr * 360 / 2 / Math.PI;
+
+ if (h < 0) {
+ h += 360;
+ }
+
+ const c = Math.sqrt(a * a + b * b);
+
+ return [l, c, h];
+};
+
+convert.lch.lab = function (lch) {
+ const l = lch[0];
+ const c = lch[1];
+ const h = lch[2];
+
+ const hr = h / 360 * 2 * Math.PI;
+ const a = c * Math.cos(hr);
+ const b = c * Math.sin(hr);
+
+ return [l, a, b];
+};
+
+convert.rgb.ansi16 = function (args, saturation = null) {
+ const [r, g, b] = args;
+ let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization
+
+ value = Math.round(value / 50);
+
+ if (value === 0) {
+ return 30;
+ }
+
+ let ansi = 30
+ + ((Math.round(b / 255) << 2)
+ | (Math.round(g / 255) << 1)
+ | Math.round(r / 255));
+
+ if (value === 2) {
+ ansi += 60;
+ }
+
+ return ansi;
+};
+
+convert.hsv.ansi16 = function (args) {
+ // Optimization here; we already know the value and don't need to get
+ // it converted for us.
+ return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
+};
+
+convert.rgb.ansi256 = function (args) {
+ const r = args[0];
+ const g = args[1];
+ const b = args[2];
+
+ // We use the extended greyscale palette here, with the exception of
+ // black and white. normal palette only has 4 greyscale shades.
+ if (r === g && g === b) {
+ if (r < 8) {
+ return 16;
+ }
+
+ if (r > 248) {
+ return 231;
+ }
+
+ return Math.round(((r - 8) / 247) * 24) + 232;
+ }
+
+ const ansi = 16
+ + (36 * Math.round(r / 255 * 5))
+ + (6 * Math.round(g / 255 * 5))
+ + Math.round(b / 255 * 5);
+
+ return ansi;
+};
+
+convert.ansi16.rgb = function (args) {
+ let color = args % 10;
+
+ // Handle greyscale
+ if (color === 0 || color === 7) {
+ if (args > 50) {
+ color += 3.5;
+ }
+
+ color = color / 10.5 * 255;
+
+ return [color, color, color];
+ }
+
+ const mult = (~~(args > 50) + 1) * 0.5;
+ const r = ((color & 1) * mult) * 255;
+ const g = (((color >> 1) & 1) * mult) * 255;
+ const b = (((color >> 2) & 1) * mult) * 255;
+
+ return [r, g, b];
+};
+
+convert.ansi256.rgb = function (args) {
+ // Handle greyscale
+ if (args >= 232) {
+ const c = (args - 232) * 10 + 8;
+ return [c, c, c];
+ }
+
+ args -= 16;
+
+ let rem;
+ const r = Math.floor(args / 36) / 5 * 255;
+ const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
+ const b = (rem % 6) / 5 * 255;
+
+ return [r, g, b];
+};
+
+convert.rgb.hex = function (args) {
+ const integer = ((Math.round(args[0]) & 0xFF) << 16)
+ + ((Math.round(args[1]) & 0xFF) << 8)
+ + (Math.round(args[2]) & 0xFF);
+
+ const string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.hex.rgb = function (args) {
+ const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
+ if (!match) {
+ return [0, 0, 0];
+ }
+
+ let colorString = match[0];
+
+ if (match[0].length === 3) {
+ colorString = colorString.split('').map(char => {
+ return char + char;
+ }).join('');
+ }
+
+ const integer = parseInt(colorString, 16);
+ const r = (integer >> 16) & 0xFF;
+ const g = (integer >> 8) & 0xFF;
+ const b = integer & 0xFF;
+
+ return [r, g, b];
+};
+
+convert.rgb.hcg = function (rgb) {
+ const r = rgb[0] / 255;
+ const g = rgb[1] / 255;
+ const b = rgb[2] / 255;
+ const max = Math.max(Math.max(r, g), b);
+ const min = Math.min(Math.min(r, g), b);
+ const chroma = (max - min);
+ let grayscale;
+ let hue;
+
+ if (chroma < 1) {
+ grayscale = min / (1 - chroma);
+ } else {
+ grayscale = 0;
+ }
+
+ if (chroma <= 0) {
+ hue = 0;
+ } else
+ if (max === r) {
+ hue = ((g - b) / chroma) % 6;
+ } else
+ if (max === g) {
+ hue = 2 + (b - r) / chroma;
+ } else {
+ hue = 4 + (r - g) / chroma;
+ }
+
+ hue /= 6;
+ hue %= 1;
+
+ return [hue * 360, chroma * 100, grayscale * 100];
+};
+
+convert.hsl.hcg = function (hsl) {
+ const s = hsl[1] / 100;
+ const l = hsl[2] / 100;
+
+ const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));
+
+ let f = 0;
+ if (c < 1.0) {
+ f = (l - 0.5 * c) / (1.0 - c);
+ }
+
+ return [hsl[0], c * 100, f * 100];
+};
+
+convert.hsv.hcg = function (hsv) {
+ const s = hsv[1] / 100;
+ const v = hsv[2] / 100;
+
+ const c = s * v;
+ let f = 0;
+
+ if (c < 1.0) {
+ f = (v - c) / (1 - c);
+ }
+
+ return [hsv[0], c * 100, f * 100];
+};
+
+convert.hcg.rgb = function (hcg) {
+ const h = hcg[0] / 360;
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ if (c === 0.0) {
+ return [g * 255, g * 255, g * 255];
+ }
+
+ const pure = [0, 0, 0];
+ const hi = (h % 1) * 6;
+ const v = hi % 1;
+ const w = 1 - v;
+ let mg = 0;
+
+ /* eslint-disable max-statements-per-line */
+ switch (Math.floor(hi)) {
+ case 0:
+ pure[0] = 1; pure[1] = v; pure[2] = 0; break;
+ case 1:
+ pure[0] = w; pure[1] = 1; pure[2] = 0; break;
+ case 2:
+ pure[0] = 0; pure[1] = 1; pure[2] = v; break;
+ case 3:
+ pure[0] = 0; pure[1] = w; pure[2] = 1; break;
+ case 4:
+ pure[0] = v; pure[1] = 0; pure[2] = 1; break;
+ default:
+ pure[0] = 1; pure[1] = 0; pure[2] = w;
+ }
+ /* eslint-enable max-statements-per-line */
+
+ mg = (1.0 - c) * g;
+
+ return [
+ (c * pure[0] + mg) * 255,
+ (c * pure[1] + mg) * 255,
+ (c * pure[2] + mg) * 255
+ ];
+};
+
+convert.hcg.hsv = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ const v = c + g * (1.0 - c);
+ let f = 0;
+
+ if (v > 0.0) {
+ f = c / v;
+ }
+
+ return [hcg[0], f * 100, v * 100];
+};
+
+convert.hcg.hsl = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+
+ const l = g * (1.0 - c) + 0.5 * c;
+ let s = 0;
+
+ if (l > 0.0 && l < 0.5) {
+ s = c / (2 * l);
+ } else
+ if (l >= 0.5 && l < 1.0) {
+ s = c / (2 * (1 - l));
+ }
+
+ return [hcg[0], s * 100, l * 100];
+};
+
+convert.hcg.hwb = function (hcg) {
+ const c = hcg[1] / 100;
+ const g = hcg[2] / 100;
+ const v = c + g * (1.0 - c);
+ return [hcg[0], (v - c) * 100, (1 - v) * 100];
+};
+
+convert.hwb.hcg = function (hwb) {
+ const w = hwb[1] / 100;
+ const b = hwb[2] / 100;
+ const v = 1 - b;
+ const c = v - w;
+ let g = 0;
+
+ if (c < 1) {
+ g = (v - c) / (1 - c);
+ }
+
+ return [hwb[0], c * 100, g * 100];
+};
+
+convert.apple.rgb = function (apple) {
+ return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
+};
+
+convert.rgb.apple = function (rgb) {
+ return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
+};
+
+convert.gray.rgb = function (args) {
+ return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
+};
+
+convert.gray.hsl = function (args) {
+ return [0, 0, args[0]];
+};
+
+convert.gray.hsv = convert.gray.hsl;
+
+convert.gray.hwb = function (gray) {
+ return [0, 100, gray[0]];
+};
+
+convert.gray.cmyk = function (gray) {
+ return [0, 0, 0, gray[0]];
+};
+
+convert.gray.lab = function (gray) {
+ return [gray[0], 0, 0];
+};
+
+convert.gray.hex = function (gray) {
+ const val = Math.round(gray[0] / 100 * 255) & 0xFF;
+ const integer = (val << 16) + (val << 8) + val;
+
+ const string = integer.toString(16).toUpperCase();
+ return '000000'.substring(string.length) + string;
+};
+
+convert.rgb.gray = function (rgb) {
+ const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
+ return [val / 255 * 100];
+};
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/index.js b/uni_modules/wu-ui-tools/libs/function/color/color-convert/index.js
new file mode 100644
index 0000000..85b580c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/index.js
@@ -0,0 +1,81 @@
+import route from './route'
+import conversions from './conversions'
+
+const convert = {};
+
+const models = Object.keys(conversions);
+
+function wrapRaw(fn) {
+ const wrappedFn = function (...args) {
+ const arg0 = args[0];
+ if (arg0 === undefined || arg0 === null) {
+ return arg0;
+ }
+
+ if (arg0.length > 1) {
+ args = arg0;
+ }
+
+ return fn(args);
+ };
+
+ // Preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+function wrapRounded(fn) {
+ const wrappedFn = function (...args) {
+ const arg0 = args[0];
+
+ if (arg0 === undefined || arg0 === null) {
+ return arg0;
+ }
+
+ if (arg0.length > 1) {
+ args = arg0;
+ }
+
+ const result = fn(args);
+
+ // We're assuming the result is an array here.
+ // see notice in conversions.js; don't use box types
+ // in conversion functions.
+ if (typeof result === 'object') {
+ for (let len = result.length, i = 0; i < len; i++) {
+ result[i] = Math.round(result[i]);
+ }
+ }
+
+ return result;
+ };
+
+ // Preserve .conversion property if there is one
+ if ('conversion' in fn) {
+ wrappedFn.conversion = fn.conversion;
+ }
+
+ return wrappedFn;
+}
+
+models.forEach(fromModel => {
+ convert[fromModel] = {};
+
+ Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
+ Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
+
+ const routes = route(fromModel);
+ const routeModels = Object.keys(routes);
+
+ routeModels.forEach(toModel => {
+ const fn = routes[toModel];
+
+ convert[fromModel][toModel] = wrapRounded(fn);
+ convert[fromModel][toModel].raw = wrapRaw(fn);
+ });
+});
+
+export default convert;
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/package.json b/uni_modules/wu-ui-tools/libs/function/color/color-convert/package.json
new file mode 100644
index 0000000..6e48000
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "color-convert",
+ "description": "Plain color conversion functions",
+ "version": "2.0.1",
+ "author": "Heather Arthur ",
+ "license": "MIT",
+ "repository": "Qix-/color-convert",
+ "scripts": {
+ "pretest": "xo",
+ "test": "node test/basic.js"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ },
+ "keywords": [
+ "color",
+ "colour",
+ "convert",
+ "converter",
+ "conversion",
+ "rgb",
+ "hsl",
+ "hsv",
+ "hwb",
+ "cmyk",
+ "ansi",
+ "ansi16"
+ ],
+ "files": [
+ "index.js",
+ "conversions.js",
+ "route.js"
+ ],
+ "xo": {
+ "rules": {
+ "default-case": 0,
+ "no-inline-comments": 0,
+ "operator-linebreak": 0
+ }
+ },
+ "devDependencies": {
+ "chalk": "^2.4.2",
+ "xo": "^0.24.0"
+ },
+ "dependencies": {
+ "color-name": "~1.1.4"
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-convert/route.js b/uni_modules/wu-ui-tools/libs/function/color/color-convert/route.js
new file mode 100644
index 0000000..e210bfe
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-convert/route.js
@@ -0,0 +1,97 @@
+import conversions from './conversions'
+
+/*
+ This function routes a model to all other models.
+
+ all functions that are routed have a property `.conversion` attached
+ to the returned synthetic function. This property is an array
+ of strings, each with the steps in between the 'from' and 'to'
+ color models (inclusive).
+
+ conversions that are not possible simply are not included.
+*/
+
+function buildGraph() {
+ const graph = {};
+ // https://jsperf.com/object-keys-vs-for-in-with-closure/3
+ const models = Object.keys(conversions);
+
+ for (let len = models.length, i = 0; i < len; i++) {
+ graph[models[i]] = {
+ // http://jsperf.com/1-vs-infinity
+ // micro-opt, but this is simple.
+ distance: -1,
+ parent: null
+ };
+ }
+
+ return graph;
+}
+
+// https://en.wikipedia.org/wiki/Breadth-first_search
+function deriveBFS(fromModel) {
+ const graph = buildGraph();
+ const queue = [fromModel]; // Unshift -> queue -> pop
+
+ graph[fromModel].distance = 0;
+
+ while (queue.length) {
+ const current = queue.pop();
+ const adjacents = Object.keys(conversions[current]);
+
+ for (let len = adjacents.length, i = 0; i < len; i++) {
+ const adjacent = adjacents[i];
+ const node = graph[adjacent];
+
+ if (node.distance === -1) {
+ node.distance = graph[current].distance + 1;
+ node.parent = current;
+ queue.unshift(adjacent);
+ }
+ }
+ }
+
+ return graph;
+}
+
+function link(from, to) {
+ return function (args) {
+ return to(from(args));
+ };
+}
+
+function wrapConversion(toModel, graph) {
+ const path = [graph[toModel].parent, toModel];
+ let fn = conversions[graph[toModel].parent][toModel];
+
+ let cur = graph[toModel].parent;
+ while (graph[cur].parent) {
+ path.unshift(graph[cur].parent);
+ fn = link(conversions[graph[cur].parent][cur], fn);
+ cur = graph[cur].parent;
+ }
+
+ fn.conversion = path;
+ return fn;
+}
+
+export default function (fromModel) {
+ const graph = deriveBFS(fromModel);
+ const conversion = {};
+
+ const models = Object.keys(graph);
+ for (let len = models.length, i = 0; i < len; i++) {
+ const toModel = models[i];
+ const node = graph[toModel];
+
+ if (node.parent === null) {
+ // No possible conversion, or this node is the source model.
+ continue;
+ }
+
+ conversion[toModel] = wrapConversion(toModel, graph);
+ }
+
+ return conversion;
+};
+
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-name/LICENSE b/uni_modules/wu-ui-tools/libs/function/color/color-name/LICENSE
new file mode 100644
index 0000000..4d9802a
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-name/LICENSE
@@ -0,0 +1,8 @@
+The MIT License (MIT)
+Copyright (c) 2015 Dmitry Ivanov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-name/README.md b/uni_modules/wu-ui-tools/libs/function/color/color-name/README.md
new file mode 100644
index 0000000..3611a6b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-name/README.md
@@ -0,0 +1,11 @@
+A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
+
+[](https://nodei.co/npm/color-name/)
+
+
+```js
+var colors = require('color-name');
+colors.red //[255,0,0]
+```
+
+
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-name/index.js b/uni_modules/wu-ui-tools/libs/function/color/color-name/index.js
new file mode 100644
index 0000000..7d4ac40
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-name/index.js
@@ -0,0 +1,152 @@
+'use strict'
+
+export default {
+ "aliceblue": [240, 248, 255],
+ "antiquewhite": [250, 235, 215],
+ "aqua": [0, 255, 255],
+ "aquamarine": [127, 255, 212],
+ "azure": [240, 255, 255],
+ "beige": [245, 245, 220],
+ "bisque": [255, 228, 196],
+ "black": [0, 0, 0],
+ "blanchedalmond": [255, 235, 205],
+ "blue": [0, 0, 255],
+ "blueviolet": [138, 43, 226],
+ "brown": [165, 42, 42],
+ "burlywood": [222, 184, 135],
+ "cadetblue": [95, 158, 160],
+ "chartreuse": [127, 255, 0],
+ "chocolate": [210, 105, 30],
+ "coral": [255, 127, 80],
+ "cornflowerblue": [100, 149, 237],
+ "cornsilk": [255, 248, 220],
+ "crimson": [220, 20, 60],
+ "cyan": [0, 255, 255],
+ "darkblue": [0, 0, 139],
+ "darkcyan": [0, 139, 139],
+ "darkgoldenrod": [184, 134, 11],
+ "darkgray": [169, 169, 169],
+ "darkgreen": [0, 100, 0],
+ "darkgrey": [169, 169, 169],
+ "darkkhaki": [189, 183, 107],
+ "darkmagenta": [139, 0, 139],
+ "darkolivegreen": [85, 107, 47],
+ "darkorange": [255, 140, 0],
+ "darkorchid": [153, 50, 204],
+ "darkred": [139, 0, 0],
+ "darksalmon": [233, 150, 122],
+ "darkseagreen": [143, 188, 143],
+ "darkslateblue": [72, 61, 139],
+ "darkslategray": [47, 79, 79],
+ "darkslategrey": [47, 79, 79],
+ "darkturquoise": [0, 206, 209],
+ "darkviolet": [148, 0, 211],
+ "deeppink": [255, 20, 147],
+ "deepskyblue": [0, 191, 255],
+ "dimgray": [105, 105, 105],
+ "dimgrey": [105, 105, 105],
+ "dodgerblue": [30, 144, 255],
+ "firebrick": [178, 34, 34],
+ "floralwhite": [255, 250, 240],
+ "forestgreen": [34, 139, 34],
+ "fuchsia": [255, 0, 255],
+ "gainsboro": [220, 220, 220],
+ "ghostwhite": [248, 248, 255],
+ "gold": [255, 215, 0],
+ "goldenrod": [218, 165, 32],
+ "gray": [128, 128, 128],
+ "green": [0, 128, 0],
+ "greenyellow": [173, 255, 47],
+ "grey": [128, 128, 128],
+ "honeydew": [240, 255, 240],
+ "hotpink": [255, 105, 180],
+ "indianred": [205, 92, 92],
+ "indigo": [75, 0, 130],
+ "ivory": [255, 255, 240],
+ "khaki": [240, 230, 140],
+ "lavender": [230, 230, 250],
+ "lavenderblush": [255, 240, 245],
+ "lawngreen": [124, 252, 0],
+ "lemonchiffon": [255, 250, 205],
+ "lightblue": [173, 216, 230],
+ "lightcoral": [240, 128, 128],
+ "lightcyan": [224, 255, 255],
+ "lightgoldenrodyellow": [250, 250, 210],
+ "lightgray": [211, 211, 211],
+ "lightgreen": [144, 238, 144],
+ "lightgrey": [211, 211, 211],
+ "lightpink": [255, 182, 193],
+ "lightsalmon": [255, 160, 122],
+ "lightseagreen": [32, 178, 170],
+ "lightskyblue": [135, 206, 250],
+ "lightslategray": [119, 136, 153],
+ "lightslategrey": [119, 136, 153],
+ "lightsteelblue": [176, 196, 222],
+ "lightyellow": [255, 255, 224],
+ "lime": [0, 255, 0],
+ "limegreen": [50, 205, 50],
+ "linen": [250, 240, 230],
+ "magenta": [255, 0, 255],
+ "maroon": [128, 0, 0],
+ "mediumaquamarine": [102, 205, 170],
+ "mediumblue": [0, 0, 205],
+ "mediumorchid": [186, 85, 211],
+ "mediumpurple": [147, 112, 219],
+ "mediumseagreen": [60, 179, 113],
+ "mediumslateblue": [123, 104, 238],
+ "mediumspringgreen": [0, 250, 154],
+ "mediumturquoise": [72, 209, 204],
+ "mediumvioletred": [199, 21, 133],
+ "midnightblue": [25, 25, 112],
+ "mintcream": [245, 255, 250],
+ "mistyrose": [255, 228, 225],
+ "moccasin": [255, 228, 181],
+ "navajowhite": [255, 222, 173],
+ "navy": [0, 0, 128],
+ "oldlace": [253, 245, 230],
+ "olive": [128, 128, 0],
+ "olivedrab": [107, 142, 35],
+ "orange": [255, 165, 0],
+ "orangered": [255, 69, 0],
+ "orchid": [218, 112, 214],
+ "palegoldenrod": [238, 232, 170],
+ "palegreen": [152, 251, 152],
+ "paleturquoise": [175, 238, 238],
+ "palevioletred": [219, 112, 147],
+ "papayawhip": [255, 239, 213],
+ "peachpuff": [255, 218, 185],
+ "peru": [205, 133, 63],
+ "pink": [255, 192, 203],
+ "plum": [221, 160, 221],
+ "powderblue": [176, 224, 230],
+ "purple": [128, 0, 128],
+ "rebeccapurple": [102, 51, 153],
+ "red": [255, 0, 0],
+ "rosybrown": [188, 143, 143],
+ "royalblue": [65, 105, 225],
+ "saddlebrown": [139, 69, 19],
+ "salmon": [250, 128, 114],
+ "sandybrown": [244, 164, 96],
+ "seagreen": [46, 139, 87],
+ "seashell": [255, 245, 238],
+ "sienna": [160, 82, 45],
+ "silver": [192, 192, 192],
+ "skyblue": [135, 206, 235],
+ "slateblue": [106, 90, 205],
+ "slategray": [112, 128, 144],
+ "slategrey": [112, 128, 144],
+ "snow": [255, 250, 250],
+ "springgreen": [0, 255, 127],
+ "steelblue": [70, 130, 180],
+ "tan": [210, 180, 140],
+ "teal": [0, 128, 128],
+ "thistle": [216, 191, 216],
+ "tomato": [255, 99, 71],
+ "turquoise": [64, 224, 208],
+ "violet": [238, 130, 238],
+ "wheat": [245, 222, 179],
+ "white": [255, 255, 255],
+ "whitesmoke": [245, 245, 245],
+ "yellow": [255, 255, 0],
+ "yellowgreen": [154, 205, 50]
+};
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-name/package.json b/uni_modules/wu-ui-tools/libs/function/color/color-name/package.json
new file mode 100644
index 0000000..7acc902
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-name/package.json
@@ -0,0 +1,28 @@
+{
+ "name": "color-name",
+ "version": "1.1.4",
+ "description": "A list of color names and its values",
+ "main": "index.js",
+ "files": [
+ "index.js"
+ ],
+ "scripts": {
+ "test": "node test.js"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git@github.com:colorjs/color-name.git"
+ },
+ "keywords": [
+ "color-name",
+ "color",
+ "color-keyword",
+ "keyword"
+ ],
+ "author": "DY ",
+ "license": "MIT",
+ "bugs": {
+ "url": "https://github.com/colorjs/color-name/issues"
+ },
+ "homepage": "https://github.com/colorjs/color-name"
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-string/LICENSE b/uni_modules/wu-ui-tools/libs/function/color/color-string/LICENSE
new file mode 100644
index 0000000..a8b08d4
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-string/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2011 Heather Arthur
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-string/README.md b/uni_modules/wu-ui-tools/libs/function/color/color-string/README.md
new file mode 100644
index 0000000..e58670c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-string/README.md
@@ -0,0 +1,62 @@
+# color-string
+
+> library for parsing and generating CSS color strings.
+
+## Install
+
+With [npm](http://npmjs.org/):
+
+```console
+$ npm install color-string
+```
+
+## Usage
+
+### Parsing
+
+```js
+colorString.get('#FFF') // {model: 'rgb', value: [255, 255, 255, 1]}
+colorString.get('#FFFA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
+colorString.get('#FFFFFFAA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
+colorString.get('hsl(360, 100%, 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
+colorString.get('hsl(360 100% 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
+colorString.get('hwb(60, 3%, 60%)') // {model: 'hwb', value: [60, 3, 60, 1]}
+
+colorString.get.rgb('#FFF') // [255, 255, 255, 1]
+colorString.get.rgb('blue') // [0, 0, 255, 1]
+colorString.get.rgb('rgba(200, 60, 60, 0.3)') // [200, 60, 60, 0.3]
+colorString.get.rgb('rgba(200 60 60 / 0.3)') // [200, 60, 60, 0.3]
+colorString.get.rgb('rgba(200 60 60 / 30%)') // [200, 60, 60, 0.3]
+colorString.get.rgb('rgb(200, 200, 200)') // [200, 200, 200, 1]
+colorString.get.rgb('rgb(200 200 200)') // [200, 200, 200, 1]
+
+colorString.get.hsl('hsl(360, 100%, 50%)') // [0, 100, 50, 1]
+colorString.get.hsl('hsl(360 100% 50%)') // [0, 100, 50, 1]
+colorString.get.hsl('hsla(360, 60%, 50%, 0.4)') // [0, 60, 50, 0.4]
+colorString.get.hsl('hsl(360 60% 50% / 0.4)') // [0, 60, 50, 0.4]
+
+colorString.get.hwb('hwb(60, 3%, 60%)') // [60, 3, 60, 1]
+colorString.get.hwb('hwb(60, 3%, 60%, 0.6)') // [60, 3, 60, 0.6]
+
+colorString.get.rgb('invalid color string') // null
+```
+
+### Generation
+
+```js
+colorString.to.hex([255, 255, 255]) // "#FFFFFF"
+colorString.to.hex([0, 0, 255, 0.4]) // "#0000FF66"
+colorString.to.hex([0, 0, 255], 0.4) // "#0000FF66"
+colorString.to.rgb([255, 255, 255]) // "rgb(255, 255, 255)"
+colorString.to.rgb([0, 0, 255, 0.4]) // "rgba(0, 0, 255, 0.4)"
+colorString.to.rgb([0, 0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
+colorString.to.rgb.percent([0, 0, 255]) // "rgb(0%, 0%, 100%)"
+colorString.to.keyword([255, 255, 0]) // "yellow"
+colorString.to.hsl([360, 100, 100]) // "hsl(360, 100%, 100%)"
+colorString.to.hwb([50, 3, 15]) // "hwb(50, 3%, 15%)"
+
+// all functions also support swizzling
+colorString.to.rgb(0, [0, 255], 0.4) // "rgba(0, 0, 255, 0.4)"
+colorString.to.rgb([0, 0], [255], 0.4) // "rgba(0, 0, 255, 0.4)"
+colorString.to.rgb([0], 0, [255, 0.4]) // "rgba(0, 0, 255, 0.4)"
+```
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-string/index.js b/uni_modules/wu-ui-tools/libs/function/color/color-string/index.js
new file mode 100644
index 0000000..713d14c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-string/index.js
@@ -0,0 +1,244 @@
+/* MIT license */
+import colorNames from '../color-name'
+import swizzle from '../simple-swizzle'
+var hasOwnProperty = Object.hasOwnProperty;
+
+var reverseNames = Object.create(null);
+
+// create a list of reverse color names
+for (var name in colorNames) {
+ if (hasOwnProperty.call(colorNames, name)) {
+ reverseNames[colorNames[name]] = name;
+ }
+}
+
+var cs = {
+ to: {},
+ get: {}
+};
+
+cs.get = function (string) {
+ var prefix = string.substring(0, 3).toLowerCase();
+ var val;
+ var model;
+ switch (prefix) {
+ case 'hsl':
+ val = cs.get.hsl(string);
+ model = 'hsl';
+ break;
+ case 'hwb':
+ val = cs.get.hwb(string);
+ model = 'hwb';
+ break;
+ default:
+ val = cs.get.rgb(string);
+ model = 'rgb';
+ break;
+ }
+
+ if (!val) {
+ return null;
+ }
+
+ return {model: model, value: val};
+};
+
+cs.get.rgb = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var abbr = /^#([a-f0-9]{3,4})$/i;
+ var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
+ var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
+ var keyword = /^(\w+)$/;
+
+ var rgb = [0, 0, 0, 1];
+ var match;
+ var i;
+ var hexAlpha;
+
+ if (match = string.match(hex)) {
+ hexAlpha = match[2];
+ match = match[1];
+
+ for (i = 0; i < 3; i++) {
+ // https://jsperf.com/slice-vs-substr-vs-substring-methods-long-string/19
+ var i2 = i * 2;
+ rgb[i] = parseInt(match.slice(i2, i2 + 2), 16);
+ }
+
+ if (hexAlpha) {
+ rgb[3] = parseInt(hexAlpha, 16) / 255;
+ }
+ } else if (match = string.match(abbr)) {
+ match = match[1];
+ hexAlpha = match[3];
+
+ for (i = 0; i < 3; i++) {
+ rgb[i] = parseInt(match[i] + match[i], 16);
+ }
+
+ if (hexAlpha) {
+ rgb[3] = parseInt(hexAlpha + hexAlpha, 16) / 255;
+ }
+ } else if (match = string.match(rgba)) {
+ for (i = 0; i < 3; i++) {
+ rgb[i] = parseInt(match[i + 1], 0);
+ }
+
+ if (match[4]) {
+ if (match[5]) {
+ rgb[3] = parseFloat(match[4]) * 0.01;
+ } else {
+ rgb[3] = parseFloat(match[4]);
+ }
+ }
+ } else if (match = string.match(per)) {
+ for (i = 0; i < 3; i++) {
+ rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
+ }
+
+ if (match[4]) {
+ if (match[5]) {
+ rgb[3] = parseFloat(match[4]) * 0.01;
+ } else {
+ rgb[3] = parseFloat(match[4]);
+ }
+ }
+ } else if (match = string.match(keyword)) {
+ if (match[1] === 'transparent') {
+ return [0, 0, 0, 0];
+ }
+
+ if (!hasOwnProperty.call(colorNames, match[1])) {
+ return null;
+ }
+
+ rgb = colorNames[match[1]];
+ rgb[3] = 1;
+
+ return rgb;
+ } else {
+ return null;
+ }
+
+ for (i = 0; i < 3; i++) {
+ rgb[i] = clamp(rgb[i], 0, 255);
+ }
+ rgb[3] = clamp(rgb[3], 0, 1);
+
+ return rgb;
+};
+
+cs.get.hsl = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
+ var match = string.match(hsl);
+
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
+ var s = clamp(parseFloat(match[2]), 0, 100);
+ var l = clamp(parseFloat(match[3]), 0, 100);
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
+
+ return [h, s, l, a];
+ }
+
+ return null;
+};
+
+cs.get.hwb = function (string) {
+ if (!string) {
+ return null;
+ }
+
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
+ var match = string.match(hwb);
+
+ if (match) {
+ var alpha = parseFloat(match[4]);
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
+ var w = clamp(parseFloat(match[2]), 0, 100);
+ var b = clamp(parseFloat(match[3]), 0, 100);
+ var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
+ return [h, w, b, a];
+ }
+
+ return null;
+};
+
+cs.to.hex = function () {
+ var rgba = swizzle(arguments);
+
+ return (
+ '#' +
+ hexDouble(rgba[0]) +
+ hexDouble(rgba[1]) +
+ hexDouble(rgba[2]) +
+ (rgba[3] < 1
+ ? (hexDouble(Math.round(rgba[3] * 255)))
+ : '')
+ );
+};
+
+cs.to.rgb = function () {
+ var rgba = swizzle(arguments);
+
+ return rgba.length < 4 || rgba[3] === 1
+ ? 'rgb(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ')'
+ : 'rgba(' + Math.round(rgba[0]) + ', ' + Math.round(rgba[1]) + ', ' + Math.round(rgba[2]) + ', ' + rgba[3] + ')';
+};
+
+cs.to.rgb.percent = function () {
+ var rgba = swizzle(arguments);
+
+ var r = Math.round(rgba[0] / 255 * 100);
+ var g = Math.round(rgba[1] / 255 * 100);
+ var b = Math.round(rgba[2] / 255 * 100);
+
+ return rgba.length < 4 || rgba[3] === 1
+ ? 'rgb(' + r + '%, ' + g + '%, ' + b + '%)'
+ : 'rgba(' + r + '%, ' + g + '%, ' + b + '%, ' + rgba[3] + ')';
+};
+
+cs.to.hsl = function () {
+ var hsla = swizzle(arguments);
+ return hsla.length < 4 || hsla[3] === 1
+ ? 'hsl(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%)'
+ : 'hsla(' + hsla[0] + ', ' + hsla[1] + '%, ' + hsla[2] + '%, ' + hsla[3] + ')';
+};
+
+// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
+// (hwb have alpha optional & 1 is default value)
+cs.to.hwb = function () {
+ var hwba = swizzle(arguments);
+
+ var a = '';
+ if (hwba.length >= 4 && hwba[3] !== 1) {
+ a = ', ' + hwba[3];
+ }
+
+ return 'hwb(' + hwba[0] + ', ' + hwba[1] + '%, ' + hwba[2] + '%' + a + ')';
+};
+
+cs.to.keyword = function (rgb) {
+ return reverseNames[rgb.slice(0, 3)];
+};
+
+// helpers
+function clamp(num, min, max) {
+ return Math.min(Math.max(min, num), max);
+}
+
+function hexDouble(num) {
+ var str = Math.round(num).toString(16).toUpperCase();
+ return (str.length < 2) ? '0' + str : str;
+}
+
+export default cs;
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color-string/package.json b/uni_modules/wu-ui-tools/libs/function/color/color-string/package.json
new file mode 100644
index 0000000..f34ee98
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color-string/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "color-string",
+ "description": "Parser and generator for CSS color strings",
+ "version": "1.9.1",
+ "author": "Heather Arthur ",
+ "contributors": [
+ "Maxime Thirouin",
+ "Dyma Ywanov ",
+ "Josh Junon"
+ ],
+ "repository": "Qix-/color-string",
+ "scripts": {
+ "pretest": "xo",
+ "test": "node test/basic.js"
+ },
+ "license": "MIT",
+ "files": [
+ "index.js"
+ ],
+ "xo": {
+ "rules": {
+ "no-cond-assign": 0,
+ "operator-linebreak": 0
+ }
+ },
+ "dependencies": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ },
+ "devDependencies": {
+ "xo": "^0.12.1"
+ },
+ "keywords": [
+ "color",
+ "colour",
+ "rgb",
+ "css"
+ ]
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/color/color.js b/uni_modules/wu-ui-tools/libs/function/color/color.js
new file mode 100644
index 0000000..2da7a2b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/color.js
@@ -0,0 +1,496 @@
+import colorString from './color-string'
+import convert from './color-convert'
+
+const skippedModels = [
+ // To be honest, I don't really feel like keyword belongs in color convert, but eh.
+ 'keyword',
+
+ // Gray conflicts with some method names, and has its own method defined.
+ 'gray',
+
+ // Shouldn't really be in color-convert either...
+ 'hex',
+];
+
+const hashedModelKeys = {};
+for (const model of Object.keys(convert)) {
+ hashedModelKeys[[...convert[model].labels].sort().join('')] = model;
+}
+
+const limiters = {};
+
+function Color(object, model) {
+ if (!(this instanceof Color)) {
+ return new Color(object, model);
+ }
+
+ if (model && model in skippedModels) {
+ model = null;
+ }
+
+ if (model && !(model in convert)) {
+ throw new Error('Unknown model: ' + model);
+ }
+
+ let i;
+ let channels;
+
+ if (object == null) { // eslint-disable-line no-eq-null,eqeqeq
+ this.model = 'rgb';
+ this.color = [0, 0, 0];
+ this.valpha = 1;
+ } else if (object instanceof Color) {
+ this.model = object.model;
+ this.color = [...object.color];
+ this.valpha = object.valpha;
+ } else if (typeof object === 'string') {
+ const result = colorString.get(object);
+ if (result === null) {
+ throw new Error('Unable to parse color from string: ' + object);
+ }
+
+ this.model = result.model;
+ channels = convert[this.model].channels;
+ this.color = result.value.slice(0, channels);
+ this.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;
+ } else if (object.length > 0) {
+ this.model = model || 'rgb';
+ channels = convert[this.model].channels;
+ const newArray = Array.prototype.slice.call(object, 0, channels);
+ this.color = zeroArray(newArray, channels);
+ this.valpha = typeof object[channels] === 'number' ? object[channels] : 1;
+ } else if (typeof object === 'number') {
+ // This is always RGB - can be converted later on.
+ this.model = 'rgb';
+ this.color = [
+ (object >> 16) & 0xFF,
+ (object >> 8) & 0xFF,
+ object & 0xFF,
+ ];
+ this.valpha = 1;
+ } else {
+ this.valpha = 1;
+
+ const keys = Object.keys(object);
+ if ('alpha' in object) {
+ keys.splice(keys.indexOf('alpha'), 1);
+ this.valpha = typeof object.alpha === 'number' ? object.alpha : 0;
+ }
+
+ const hashedKeys = keys.sort().join('');
+ if (!(hashedKeys in hashedModelKeys)) {
+ throw new Error('Unable to parse color from object: ' + JSON.stringify(object));
+ }
+
+ this.model = hashedModelKeys[hashedKeys];
+
+ const {labels} = convert[this.model];
+ const color = [];
+ for (i = 0; i < labels.length; i++) {
+ color.push(object[labels[i]]);
+ }
+
+ this.color = zeroArray(color);
+ }
+
+ // Perform limitations (clamping, etc.)
+ if (limiters[this.model]) {
+ channels = convert[this.model].channels;
+ for (i = 0; i < channels; i++) {
+ const limit = limiters[this.model][i];
+ if (limit) {
+ this.color[i] = limit(this.color[i]);
+ }
+ }
+ }
+
+ this.valpha = Math.max(0, Math.min(1, this.valpha));
+
+ if (Object.freeze) {
+ Object.freeze(this);
+ }
+}
+
+Color.prototype = {
+ toString() {
+ return this.string();
+ },
+
+ toJSON() {
+ return this[this.model]();
+ },
+
+ string(places) {
+ let self = this.model in colorString.to ? this : this.rgb();
+ self = self.round(typeof places === 'number' ? places : 1);
+ const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
+ return colorString.to[self.model](args);
+ },
+
+ percentString(places) {
+ const self = this.rgb().round(typeof places === 'number' ? places : 1);
+ const args = self.valpha === 1 ? self.color : [...self.color, this.valpha];
+ return colorString.to.rgb.percent(args);
+ },
+
+ array() {
+ return this.valpha === 1 ? [...this.color] : [...this.color, this.valpha];
+ },
+
+ object() {
+ const result = {};
+ const {channels} = convert[this.model];
+ const {labels} = convert[this.model];
+
+ for (let i = 0; i < channels; i++) {
+ result[labels[i]] = this.color[i];
+ }
+
+ if (this.valpha !== 1) {
+ result.alpha = this.valpha;
+ }
+
+ return result;
+ },
+
+ unitArray() {
+ const rgb = this.rgb().color;
+ rgb[0] /= 255;
+ rgb[1] /= 255;
+ rgb[2] /= 255;
+
+ if (this.valpha !== 1) {
+ rgb.push(this.valpha);
+ }
+
+ return rgb;
+ },
+
+ unitObject() {
+ const rgb = this.rgb().object();
+ rgb.r /= 255;
+ rgb.g /= 255;
+ rgb.b /= 255;
+
+ if (this.valpha !== 1) {
+ rgb.alpha = this.valpha;
+ }
+
+ return rgb;
+ },
+
+ round(places) {
+ places = Math.max(places || 0, 0);
+ return new Color([...this.color.map(roundToPlace(places)), this.valpha], this.model);
+ },
+
+ alpha(value) {
+ if (value !== undefined) {
+ return new Color([...this.color, Math.max(0, Math.min(1, value))], this.model);
+ }
+
+ return this.valpha;
+ },
+
+ // Rgb
+ red: getset('rgb', 0, maxfn(255)),
+ green: getset('rgb', 1, maxfn(255)),
+ blue: getset('rgb', 2, maxfn(255)),
+
+ hue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, value => ((value % 360) + 360) % 360),
+
+ saturationl: getset('hsl', 1, maxfn(100)),
+ lightness: getset('hsl', 2, maxfn(100)),
+
+ saturationv: getset('hsv', 1, maxfn(100)),
+ value: getset('hsv', 2, maxfn(100)),
+
+ chroma: getset('hcg', 1, maxfn(100)),
+ gray: getset('hcg', 2, maxfn(100)),
+
+ white: getset('hwb', 1, maxfn(100)),
+ wblack: getset('hwb', 2, maxfn(100)),
+
+ cyan: getset('cmyk', 0, maxfn(100)),
+ magenta: getset('cmyk', 1, maxfn(100)),
+ yellow: getset('cmyk', 2, maxfn(100)),
+ black: getset('cmyk', 3, maxfn(100)),
+
+ x: getset('xyz', 0, maxfn(95.047)),
+ y: getset('xyz', 1, maxfn(100)),
+ z: getset('xyz', 2, maxfn(108.833)),
+
+ l: getset('lab', 0, maxfn(100)),
+ a: getset('lab', 1),
+ b: getset('lab', 2),
+
+ keyword(value) {
+ if (value !== undefined) {
+ return new Color(value);
+ }
+
+ return convert[this.model].keyword(this.color);
+ },
+
+ hex(value) {
+ if (value !== undefined) {
+ return new Color(value);
+ }
+
+ return colorString.to.hex(this.rgb().round().color);
+ },
+
+ hexa(value) {
+ if (value !== undefined) {
+ return new Color(value);
+ }
+
+ const rgbArray = this.rgb().round().color;
+
+ let alphaHex = Math.round(this.valpha * 255).toString(16).toUpperCase();
+ if (alphaHex.length === 1) {
+ alphaHex = '0' + alphaHex;
+ }
+
+ return colorString.to.hex(rgbArray) + alphaHex;
+ },
+
+ rgbNumber() {
+ const rgb = this.rgb().color;
+ return ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);
+ },
+
+ luminosity() {
+ // http://www.w3.org/TR/WCAG20/#relativeluminancedef
+ const rgb = this.rgb().color;
+
+ const lum = [];
+ for (const [i, element] of rgb.entries()) {
+ const chan = element / 255;
+ lum[i] = (chan <= 0.04045) ? chan / 12.92 : ((chan + 0.055) / 1.055) ** 2.4;
+ }
+
+ return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
+ },
+
+ contrast(color2) {
+ // http://www.w3.org/TR/WCAG20/#contrast-ratiodef
+ const lum1 = this.luminosity();
+ const lum2 = color2.luminosity();
+
+ if (lum1 > lum2) {
+ return (lum1 + 0.05) / (lum2 + 0.05);
+ }
+
+ return (lum2 + 0.05) / (lum1 + 0.05);
+ },
+
+ level(color2) {
+ // https://www.w3.org/TR/WCAG/#contrast-enhanced
+ const contrastRatio = this.contrast(color2);
+ if (contrastRatio >= 7) {
+ return 'AAA';
+ }
+
+ return (contrastRatio >= 4.5) ? 'AA' : '';
+ },
+
+ isDark() {
+ // YIQ equation from http://24ways.org/2010/calculating-color-contrast
+ const rgb = this.rgb().color;
+ const yiq = (rgb[0] * 2126 + rgb[1] * 7152 + rgb[2] * 722) / 10000;
+ return yiq < 128;
+ },
+
+ isLight() {
+ return !this.isDark();
+ },
+
+ negate() {
+ const rgb = this.rgb();
+ for (let i = 0; i < 3; i++) {
+ rgb.color[i] = 255 - rgb.color[i];
+ }
+
+ return rgb;
+ },
+
+ lighten(ratio) {
+ const hsl = this.hsl();
+ hsl.color[2] += hsl.color[2] * ratio;
+ return hsl;
+ },
+
+ darken(ratio) {
+ const hsl = this.hsl();
+ hsl.color[2] -= hsl.color[2] * ratio;
+ return hsl;
+ },
+
+ saturate(ratio) {
+ const hsl = this.hsl();
+ hsl.color[1] += hsl.color[1] * ratio;
+ return hsl;
+ },
+
+ desaturate(ratio) {
+ const hsl = this.hsl();
+ hsl.color[1] -= hsl.color[1] * ratio;
+ return hsl;
+ },
+
+ whiten(ratio) {
+ const hwb = this.hwb();
+ hwb.color[1] += hwb.color[1] * ratio;
+ return hwb;
+ },
+
+ blacken(ratio) {
+ const hwb = this.hwb();
+ hwb.color[2] += hwb.color[2] * ratio;
+ return hwb;
+ },
+
+ grayscale() {
+ // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
+ const rgb = this.rgb().color;
+ const value = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
+ return Color.rgb(value, value, value);
+ },
+
+ fade(ratio) {
+ return this.alpha(this.valpha - (this.valpha * ratio));
+ },
+
+ opaquer(ratio) {
+ return this.alpha(this.valpha + (this.valpha * ratio));
+ },
+
+ rotate(degrees) {
+ const hsl = this.hsl();
+ let hue = hsl.color[0];
+ hue = (hue + degrees) % 360;
+ hue = hue < 0 ? 360 + hue : hue;
+ hsl.color[0] = hue;
+ return hsl;
+ },
+
+ mix(mixinColor, weight) {
+ // Ported from sass implementation in C
+ // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
+ if (!mixinColor || !mixinColor.rgb) {
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
+ }
+
+ const color1 = mixinColor.rgb();
+ const color2 = this.rgb();
+ const p = weight === undefined ? 0.5 : weight;
+
+ const w = 2 * p - 1;
+ const a = color1.alpha() - color2.alpha();
+
+ const w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2;
+ const w2 = 1 - w1;
+
+ return Color.rgb(
+ w1 * color1.red() + w2 * color2.red(),
+ w1 * color1.green() + w2 * color2.green(),
+ w1 * color1.blue() + w2 * color2.blue(),
+ color1.alpha() * p + color2.alpha() * (1 - p));
+ },
+};
+
+// Model conversion methods and static constructors
+for (const model of Object.keys(convert)) {
+ if (skippedModels.includes(model)) {
+ continue;
+ }
+
+ const {channels} = convert[model];
+
+ // Conversion methods
+ Color.prototype[model] = function (...args) {
+ if (this.model === model) {
+ return new Color(this);
+ }
+
+ if (args.length > 0) {
+ return new Color(args, model);
+ }
+
+ return new Color([...assertArray(convert[this.model][model].raw(this.color)), this.valpha], model);
+ };
+
+ // 'static' construction methods
+ Color[model] = function (...args) {
+ let color = args[0];
+ if (typeof color === 'number') {
+ color = zeroArray(args, channels);
+ }
+
+ return new Color(color, model);
+ };
+}
+
+function roundTo(number, places) {
+ return Number(number.toFixed(places));
+}
+
+function roundToPlace(places) {
+ return function (number) {
+ return roundTo(number, places);
+ };
+}
+
+function getset(model, channel, modifier) {
+ model = Array.isArray(model) ? model : [model];
+
+ for (const m of model) {
+ (limiters[m] || (limiters[m] = []))[channel] = modifier;
+ }
+
+ model = model[0];
+
+ return function (value) {
+ let result;
+
+ if (value !== undefined) {
+ if (modifier) {
+ value = modifier(value);
+ }
+
+ result = this[model]();
+ result.color[channel] = value;
+ return result;
+ }
+
+ result = this[model]().color[channel];
+ if (modifier) {
+ result = modifier(result);
+ }
+
+ return result;
+ };
+}
+
+function maxfn(max) {
+ return function (v) {
+ return Math.max(0, Math.min(max, v));
+ };
+}
+
+function assertArray(value) {
+ return Array.isArray(value) ? value : [value];
+}
+
+function zeroArray(array, length) {
+ for (let i = 0; i < length; i++) {
+ if (typeof array[i] !== 'number') {
+ array[i] = 0;
+ }
+ }
+
+ return array;
+}
+
+export default Color;
diff --git a/uni_modules/wu-ui-tools/libs/function/color/index.js b/uni_modules/wu-ui-tools/libs/function/color/index.js
new file mode 100644
index 0000000..fe6a1e4
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/index.js
@@ -0,0 +1,158 @@
+import Color from './color';
+
+/**
+ * 转换颜色格式。
+ * @param {Object} params - 参数对象。
+ * @param {string} color - 输入的颜色,默认为 '#fff'。
+ * @param {string} format - 需要转换的格式(支持 'rgb', 'hex', 'hsl', 'hsv', 'hwb')。
+ * @param {string} type - 转换后的类型(支持 'string', 'object', 'array', 'round')。
+ * @returns {string|Object|Array} 转换后的颜色表示。
+ */
+function convertFormat(color = '#fff', format = 'rgb', type = 'string') {
+ let colorObj = Color(color);
+ // 如果格式存在
+ if (colorObj[format]) {
+ // hex 无法直接转换为 除string类型外的任何类型
+ // 所以转为rgb 后 获取其他类型
+ if(format == 'hex' && type != 'string') format = 'rgb';
+ // 类型名称
+ let typeName = '';
+ switch (type) {
+ case 'string':
+ typeName = 'toString';
+ break;
+ case 'object':
+ typeName = 'object';
+ break;
+ case 'array':
+ typeName = 'array';
+ break;
+ case 'round':
+ typeName = 'round';
+ break;
+ default:
+ throw Error('Unsupported target type:' + type)
+ }
+ return colorObj[format]()[typeName]();
+ } else {
+ throw Error('Unsupported target format: ' + format);
+ }
+}
+
+/**
+ * 计算两个颜色之间的渐变值。
+ * @param {string} startColor - 开始的颜色,默认为黑色。
+ * @param {string} endColor - 结束的颜色,默认为白色。
+ * @param {number} step - 渐变的步数,默认为10。
+ * @returns {Array} 两个颜色之间的渐变颜色数组。
+ */
+function gradient(startColor = 'rgb(0, 0, 0)', endColor = 'rgb(255, 255, 255)', step = 10) {
+ const startRGB = convertFormat(startColor, 'rgb', 'array') // 转换为rgb数组模式
+ const startR = startRGB[0]
+ const startG = startRGB[1]
+ const startB = startRGB[2]
+
+ const endRGB = convertFormat(endColor, 'rgb', 'array')
+ const endR = endRGB[0]
+ const endG = endRGB[1]
+ const endB = endRGB[2]
+
+ const sR = (endR - startR) / step // 总差值
+ const sG = (endG - startG) / step
+ const sB = (endB - startB) / step
+ const colorArr = []
+ for (let i = 0; i < step; i++) {
+ // 计算每一步的hex值
+ let hex = convertFormat(`rgb(${Math.round((sR * i + startR))},${Math.round((sG * i + startG))},${Math.round((sB
+ * i + startB))})`, 'hex')
+ // 确保第一个颜色值为startColor的值
+ if (i === 0) hex = convertFormat(startColor, 'hex')
+ // 确保最后一个颜色值为endColor的值
+ if (i === step - 1) hex = convertFormat(endColor, 'hex')
+ colorArr.push(hex)
+ }
+ return colorArr
+}
+
+
+
+export default {
+ /**
+ * 格式转换。
+ */
+ convertFormat,
+
+ /**
+ * 计算两个颜色之间的渐变值。
+ */
+ gradient,
+
+ /**
+ * 增加颜色的亮度。
+ * @param {string} color - 输入的颜色。
+ * @param {number} value - 增加的亮度值(0-1)。
+ * @returns {string} 调整后的颜色。
+ */
+ lighten: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).lighten(value), format, type),
+
+ /**
+ * 减少颜色的亮度。
+ * @param {string} color - 输入的颜色。
+ * @param {number} value - 减少的亮度值(0-1)。
+ * @returns {string} 调整后的颜色。
+ */
+ darken: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).darken(value), format, type),
+
+ /**
+ * 增加颜色的饱和度。
+ * @param {string} color - 输入的颜色。
+ * @param {number} value - 增加的饱和度值(0-1)。
+ * @returns {string} 调整后的颜色。
+ */
+ saturate: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).saturate(value), format, type),
+
+ /**
+ * 减少颜色的饱和度。
+ * @param {string} color - 输入的颜色。
+ * @param {number} value - 减少的饱和度值(0-1)。
+ * @returns {string} 调整后的颜色。
+ */
+ desaturate: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).desaturate(value), format, type),
+
+ /**
+ * 旋转颜色的色相。
+ * @param {string} color - 输入的颜色。
+ * @param {number} degrees - 旋转的度数。
+ * @returns {string} 调整后的颜色。
+ */
+ rotate: (color, degrees, format = 'rgb', type = 'string') => convertFormat(Color(color).rotate(degrees), format, type),
+
+ /**
+ * 调整颜色的透明度。
+ * @param {string} color - 输入的颜色。
+ * @param {number} value - 透明度值(0-1,其中 1 是不透明)。
+ * @returns {string} 调整后的颜色。
+ */
+ adjustAlpha: (color, value, format = 'rgb', type = 'string') => convertFormat(Color(color).alpha(value), format, type),
+
+ /**
+ * 获取颜色的亮度。
+ * @param {string} color - 输入的颜色。
+ * @returns {number} 颜色的亮度值(0-1)。
+ */
+ luminosity: (color, format) => Color(color).luminosity(),
+
+ /**
+ * 判断颜色是否为暗色。
+ * @param {string} color - 输入的颜色。
+ * @returns {boolean} 如果是暗色则返回 true,否则返回 false。
+ */
+ isDark: (color, format) => Color(color).isDark(),
+
+ /**
+ * 判断颜色是否为亮色。
+ * @param {string} color - 输入的颜色。
+ * @returns {boolean} 如果是亮色则返回 true,否则返回 false。
+ */
+ isLight: (color, format) => Color(color).isLight()
+};
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/LICENSE b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/LICENSE
new file mode 100644
index 0000000..0a5f461
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 JD Ballard
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/README.md b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/README.md
new file mode 100644
index 0000000..7d36072
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/README.md
@@ -0,0 +1,16 @@
+# node-is-arrayish [](https://travis-ci.org/Qix-/node-is-arrayish) [](https://coveralls.io/r/Qix-/node-is-arrayish)
+> Determines if an object can be used like an Array
+
+## Example
+```javascript
+var isArrayish = require('is-arrayish');
+
+isArrayish([]); // true
+isArrayish({__proto__: []}); // true
+isArrayish({}); // false
+isArrayish({length:10}); // false
+```
+
+## License
+Licensed under the [MIT License](http://opensource.org/licenses/MIT).
+You can find a copy of it in [LICENSE](LICENSE).
diff --git a/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/index.js b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/index.js
new file mode 100644
index 0000000..18d3bbe
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/index.js
@@ -0,0 +1,9 @@
+export default function isArrayish(obj) {
+ if (!obj || typeof obj === 'string') {
+ return false;
+ }
+
+ return obj instanceof Array || Array.isArray(obj) ||
+ (obj.length >= 0 && (obj.splice instanceof Function ||
+ (Object.getOwnPropertyDescriptor(obj, (obj.length - 1)) && obj.constructor.name !== 'String')));
+};
diff --git a/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/package.json b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/package.json
new file mode 100644
index 0000000..8a54e33
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/package.json
@@ -0,0 +1,45 @@
+{
+ "name": "is-arrayish",
+ "description": "Determines if an object can be used as an array",
+ "version": "0.3.2",
+ "author": "Qix (http://github.com/qix-)",
+ "keywords": [
+ "is",
+ "array",
+ "duck",
+ "type",
+ "arrayish",
+ "similar",
+ "proto",
+ "prototype",
+ "type"
+ ],
+ "license": "MIT",
+ "scripts": {
+ "test": "mocha --require coffeescript/register ./test/**/*.coffee",
+ "lint": "zeit-eslint --ext .jsx,.js .",
+ "lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/qix-/node-is-arrayish.git"
+ },
+ "devDependencies": {
+ "@zeit/eslint-config-node": "^0.3.0",
+ "@zeit/git-hooks": "^0.1.4",
+ "coffeescript": "^2.3.1",
+ "coveralls": "^3.0.1",
+ "eslint": "^4.19.1",
+ "istanbul": "^0.4.5",
+ "mocha": "^5.2.0",
+ "should": "^13.2.1"
+ },
+ "eslintConfig": {
+ "extends": [
+ "@zeit/eslint-config-node"
+ ]
+ },
+ "git": {
+ "pre-commit": "lint-staged"
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/yarn-error.log b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/yarn-error.log
new file mode 100644
index 0000000..d3dcf37
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/is-arrayish/yarn-error.log
@@ -0,0 +1,1443 @@
+Arguments:
+ /Users/junon/n/bin/node /Users/junon/.yarn/bin/yarn.js test
+
+PATH:
+ /Users/junon/.yarn/bin:/Users/junon/.config/yarn/global/node_modules/.bin:/Users/junon/perl5/bin:/Users/junon/google-cloud-sdk/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/junon/bin:/Users/junon/.local/bin:/src/.go/bin:/src/llvm/llvm/build/bin:/Users/junon/Library/Android/sdk/platform-tools:/Users/junon/n/bin:/usr/local/texlive/2017/bin/x86_64-darwin/
+
+Yarn version:
+ 1.5.1
+
+Node version:
+ 9.6.1
+
+Platform:
+ darwin x64
+
+npm manifest:
+ {
+ "name": "is-arrayish",
+ "description": "Determines if an object can be used as an array",
+ "version": "0.3.1",
+ "author": "Qix (http://github.com/qix-)",
+ "keywords": [
+ "is",
+ "array",
+ "duck",
+ "type",
+ "arrayish",
+ "similar",
+ "proto",
+ "prototype",
+ "type"
+ ],
+ "license": "MIT",
+ "scripts": {
+ "test": "mocha --require coffeescript/register",
+ "lint": "zeit-eslint --ext .jsx,.js .",
+ "lint-staged": "git diff --diff-filter=ACMRT --cached --name-only '*.js' '*.jsx' | xargs zeit-eslint"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/qix-/node-is-arrayish.git"
+ },
+ "devDependencies": {
+ "@zeit/eslint-config-node": "^0.3.0",
+ "@zeit/git-hooks": "^0.1.4",
+ "coffeescript": "^2.3.1",
+ "coveralls": "^3.0.1",
+ "eslint": "^4.19.1",
+ "istanbul": "^0.4.5",
+ "mocha": "^5.2.0",
+ "should": "^13.2.1"
+ },
+ "eslintConfig": {
+ "extends": [
+ "@zeit/eslint-config-node"
+ ]
+ },
+ "git": {
+ "pre-commit": "lint-staged"
+ }
+ }
+
+yarn manifest:
+ No manifest
+
+Lockfile:
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+ # yarn lockfile v1
+
+
+ "@zeit/eslint-config-base@0.3.0":
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/@zeit/eslint-config-base/-/eslint-config-base-0.3.0.tgz#32a58c3e52eca4025604758cb4591f3d28e22fb4"
+ dependencies:
+ arg "^1.0.0"
+ chalk "^2.3.0"
+
+ "@zeit/eslint-config-node@^0.3.0":
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/@zeit/eslint-config-node/-/eslint-config-node-0.3.0.tgz#6e328328f366f66c2a0549a69131bbcd9735f098"
+ dependencies:
+ "@zeit/eslint-config-base" "0.3.0"
+
+ "@zeit/git-hooks@^0.1.4":
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/@zeit/git-hooks/-/git-hooks-0.1.4.tgz#70583db5dd69726a62c7963520e67f2c3a33cc5f"
+
+ abbrev@1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
+
+ abbrev@1.0.x:
+ version "1.0.9"
+ resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.0.9.tgz#91b4792588a7738c25f35dd6f63752a2f8776135"
+
+ acorn-jsx@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b"
+ dependencies:
+ acorn "^3.0.4"
+
+ acorn@^3.0.4:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
+
+ acorn@^5.5.0:
+ version "5.7.1"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.1.tgz#f095829297706a7c9776958c0afc8930a9b9d9d8"
+
+ ajv-keywords@^2.1.0:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.1.tgz#617997fc5f60576894c435f940d819e135b80762"
+
+ ajv@^5.1.0, ajv@^5.2.3, ajv@^5.3.0:
+ version "5.5.2"
+ resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965"
+ dependencies:
+ co "^4.6.0"
+ fast-deep-equal "^1.0.0"
+ fast-json-stable-stringify "^2.0.0"
+ json-schema-traverse "^0.3.0"
+
+ align-text@^0.1.1, align-text@^0.1.3:
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117"
+ dependencies:
+ kind-of "^3.0.2"
+ longest "^1.0.1"
+ repeat-string "^1.5.2"
+
+ amdefine@>=0.0.4:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5"
+
+ ansi-escapes@^3.0.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30"
+
+ ansi-regex@^2.0.0:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
+
+ ansi-regex@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
+
+ ansi-styles@^2.2.1:
+ version "2.2.1"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
+
+ ansi-styles@^3.2.1:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
+ dependencies:
+ color-convert "^1.9.0"
+
+ arg@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/arg/-/arg-1.0.1.tgz#892a26d841bd5a64880bbc8f73dd64a705910ca3"
+
+ argparse@^1.0.7:
+ version "1.0.10"
+ resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
+ dependencies:
+ sprintf-js "~1.0.2"
+
+ array-union@^1.0.1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39"
+ dependencies:
+ array-uniq "^1.0.1"
+
+ array-uniq@^1.0.1:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/array-uniq/-/array-uniq-1.0.3.tgz#af6ac877a25cc7f74e058894753858dfdb24fdb6"
+
+ arrify@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d"
+
+ asn1@~0.2.3:
+ version "0.2.3"
+ resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.3.tgz#dac8787713c9966849fc8180777ebe9c1ddf3b86"
+
+ assert-plus@1.0.0, assert-plus@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525"
+
+ async@1.x, async@^1.4.0:
+ version "1.5.2"
+ resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
+
+ asynckit@^0.4.0:
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
+
+ aws-sign2@~0.7.0:
+ version "0.7.0"
+ resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
+
+ aws4@^1.6.0:
+ version "1.7.0"
+ resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.7.0.tgz#d4d0e9b9dbfca77bf08eeb0a8a471550fe39e289"
+
+ babel-code-frame@^6.22.0:
+ version "6.26.0"
+ resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b"
+ dependencies:
+ chalk "^1.1.3"
+ esutils "^2.0.2"
+ js-tokens "^3.0.2"
+
+ balanced-match@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
+
+ bcrypt-pbkdf@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz#63bc5dcb61331b92bc05fd528953c33462a06f8d"
+ dependencies:
+ tweetnacl "^0.14.3"
+
+ brace-expansion@^1.1.7:
+ version "1.1.11"
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
+ dependencies:
+ balanced-match "^1.0.0"
+ concat-map "0.0.1"
+
+ browser-stdout@1.3.1:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"
+
+ buffer-from@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.0.tgz#87fcaa3a298358e0ade6e442cfce840740d1ad04"
+
+ caller-path@^0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/caller-path/-/caller-path-0.1.0.tgz#94085ef63581ecd3daa92444a8fe94e82577751f"
+ dependencies:
+ callsites "^0.2.0"
+
+ callsites@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/callsites/-/callsites-0.2.0.tgz#afab96262910a7f33c19a5775825c69f34e350ca"
+
+ camelcase@^1.0.2:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-1.2.1.tgz#9bb5304d2e0b56698b2c758b08a3eaa9daa58a39"
+
+ caseless@~0.12.0:
+ version "0.12.0"
+ resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
+
+ center-align@^0.1.1:
+ version "0.1.3"
+ resolved "https://registry.yarnpkg.com/center-align/-/center-align-0.1.3.tgz#aa0d32629b6ee972200411cbd4461c907bc2b7ad"
+ dependencies:
+ align-text "^0.1.3"
+ lazy-cache "^1.0.3"
+
+ chalk@^1.1.3:
+ version "1.1.3"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
+ dependencies:
+ ansi-styles "^2.2.1"
+ escape-string-regexp "^1.0.2"
+ has-ansi "^2.0.0"
+ strip-ansi "^3.0.0"
+ supports-color "^2.0.0"
+
+ chalk@^2.0.0, chalk@^2.1.0, chalk@^2.3.0:
+ version "2.4.1"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.1.tgz#18c49ab16a037b6eb0152cc83e3471338215b66e"
+ dependencies:
+ ansi-styles "^3.2.1"
+ escape-string-regexp "^1.0.5"
+ supports-color "^5.3.0"
+
+ chardet@^0.4.0:
+ version "0.4.2"
+ resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.4.2.tgz#b5473b33dc97c424e5d98dc87d55d4d8a29c8bf2"
+
+ circular-json@^0.3.1:
+ version "0.3.3"
+ resolved "https://registry.yarnpkg.com/circular-json/-/circular-json-0.3.3.tgz#815c99ea84f6809529d2f45791bdf82711352d66"
+
+ cli-cursor@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-2.1.0.tgz#b35dac376479facc3e94747d41d0d0f5238ffcb5"
+ dependencies:
+ restore-cursor "^2.0.0"
+
+ cli-width@^2.0.0:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.0.tgz#ff19ede8a9a5e579324147b0c11f0fbcbabed639"
+
+ cliui@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/cliui/-/cliui-2.1.0.tgz#4b475760ff80264c762c3a1719032e91c7fea0d1"
+ dependencies:
+ center-align "^0.1.1"
+ right-align "^0.1.1"
+ wordwrap "0.0.2"
+
+ co@^4.6.0:
+ version "4.6.0"
+ resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
+
+ coffeescript@^2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/coffeescript/-/coffeescript-2.3.1.tgz#a25f69c251d25805c9842e57fc94bfc453ef6aed"
+
+ color-convert@^1.9.0:
+ version "1.9.2"
+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.2.tgz#49881b8fba67df12a96bdf3f56c0aab9e7913147"
+ dependencies:
+ color-name "1.1.1"
+
+ color-name@1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.1.tgz#4b1415304cf50028ea81643643bd82ea05803689"
+
+ combined-stream@1.0.6, combined-stream@~1.0.5:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818"
+ dependencies:
+ delayed-stream "~1.0.0"
+
+ commander@2.15.1:
+ version "2.15.1"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-2.15.1.tgz#df46e867d0fc2aec66a34662b406a9ccafff5b0f"
+
+ concat-map@0.0.1:
+ version "0.0.1"
+ resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
+
+ concat-stream@^1.6.0:
+ version "1.6.2"
+ resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34"
+ dependencies:
+ buffer-from "^1.0.0"
+ inherits "^2.0.3"
+ readable-stream "^2.2.2"
+ typedarray "^0.0.6"
+
+ core-util-is@1.0.2, core-util-is@~1.0.0:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
+
+ coveralls@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/coveralls/-/coveralls-3.0.1.tgz#12e15914eaa29204e56869a5ece7b9e1492d2ae2"
+ dependencies:
+ js-yaml "^3.6.1"
+ lcov-parse "^0.0.10"
+ log-driver "^1.2.5"
+ minimist "^1.2.0"
+ request "^2.79.0"
+
+ cross-spawn@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449"
+ dependencies:
+ lru-cache "^4.0.1"
+ shebang-command "^1.2.0"
+ which "^1.2.9"
+
+ dashdash@^1.12.0:
+ version "1.14.1"
+ resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0"
+ dependencies:
+ assert-plus "^1.0.0"
+
+ debug@3.1.0, debug@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
+ dependencies:
+ ms "2.0.0"
+
+ decamelize@^1.0.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
+
+ deep-is@~0.1.3:
+ version "0.1.3"
+ resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34"
+
+ del@^2.0.2:
+ version "2.2.2"
+ resolved "https://registry.yarnpkg.com/del/-/del-2.2.2.tgz#c12c981d067846c84bcaf862cff930d907ffd1a8"
+ dependencies:
+ globby "^5.0.0"
+ is-path-cwd "^1.0.0"
+ is-path-in-cwd "^1.0.0"
+ object-assign "^4.0.1"
+ pify "^2.0.0"
+ pinkie-promise "^2.0.0"
+ rimraf "^2.2.8"
+
+ delayed-stream@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
+
+ diff@3.5.0:
+ version "3.5.0"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
+
+ doctrine@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d"
+ dependencies:
+ esutils "^2.0.2"
+
+ ecc-jsbn@~0.1.1:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz#0fc73a9ed5f0d53c38193398523ef7e543777505"
+ dependencies:
+ jsbn "~0.1.0"
+
+ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
+
+ escodegen@1.8.x:
+ version "1.8.1"
+ resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.8.1.tgz#5a5b53af4693110bebb0867aa3430dd3b70a1018"
+ dependencies:
+ esprima "^2.7.1"
+ estraverse "^1.9.1"
+ esutils "^2.0.2"
+ optionator "^0.8.1"
+ optionalDependencies:
+ source-map "~0.2.0"
+
+ eslint-scope@^3.7.1:
+ version "3.7.1"
+ resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
+ dependencies:
+ esrecurse "^4.1.0"
+ estraverse "^4.1.1"
+
+ eslint-visitor-keys@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
+
+ eslint@^4.19.1:
+ version "4.19.1"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.19.1.tgz#32d1d653e1d90408854bfb296f076ec7e186a300"
+ dependencies:
+ ajv "^5.3.0"
+ babel-code-frame "^6.22.0"
+ chalk "^2.1.0"
+ concat-stream "^1.6.0"
+ cross-spawn "^5.1.0"
+ debug "^3.1.0"
+ doctrine "^2.1.0"
+ eslint-scope "^3.7.1"
+ eslint-visitor-keys "^1.0.0"
+ espree "^3.5.4"
+ esquery "^1.0.0"
+ esutils "^2.0.2"
+ file-entry-cache "^2.0.0"
+ functional-red-black-tree "^1.0.1"
+ glob "^7.1.2"
+ globals "^11.0.1"
+ ignore "^3.3.3"
+ imurmurhash "^0.1.4"
+ inquirer "^3.0.6"
+ is-resolvable "^1.0.0"
+ js-yaml "^3.9.1"
+ json-stable-stringify-without-jsonify "^1.0.1"
+ levn "^0.3.0"
+ lodash "^4.17.4"
+ minimatch "^3.0.2"
+ mkdirp "^0.5.1"
+ natural-compare "^1.4.0"
+ optionator "^0.8.2"
+ path-is-inside "^1.0.2"
+ pluralize "^7.0.0"
+ progress "^2.0.0"
+ regexpp "^1.0.1"
+ require-uncached "^1.0.3"
+ semver "^5.3.0"
+ strip-ansi "^4.0.0"
+ strip-json-comments "~2.0.1"
+ table "4.0.2"
+ text-table "~0.2.0"
+
+ espree@^3.5.4:
+ version "3.5.4"
+ resolved "https://registry.yarnpkg.com/espree/-/espree-3.5.4.tgz#b0f447187c8a8bed944b815a660bddf5deb5d1a7"
+ dependencies:
+ acorn "^5.5.0"
+ acorn-jsx "^3.0.0"
+
+ esprima@2.7.x, esprima@^2.7.1:
+ version "2.7.3"
+ resolved "https://registry.yarnpkg.com/esprima/-/esprima-2.7.3.tgz#96e3b70d5779f6ad49cd032673d1c312767ba581"
+
+ esprima@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.0.tgz#4499eddcd1110e0b218bacf2fa7f7f59f55ca804"
+
+ esquery@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.1.tgz#406c51658b1f5991a5f9b62b1dc25b00e3e5c708"
+ dependencies:
+ estraverse "^4.0.0"
+
+ esrecurse@^4.1.0:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.2.1.tgz#007a3b9fdbc2b3bb87e4879ea19c92fdbd3942cf"
+ dependencies:
+ estraverse "^4.1.0"
+
+ estraverse@^1.9.1:
+ version "1.9.3"
+ resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44"
+
+ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1:
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13"
+
+ esutils@^2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b"
+
+ extend@~3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444"
+
+ external-editor@^2.0.4:
+ version "2.2.0"
+ resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-2.2.0.tgz#045511cfd8d133f3846673d1047c154e214ad3d5"
+ dependencies:
+ chardet "^0.4.0"
+ iconv-lite "^0.4.17"
+ tmp "^0.0.33"
+
+ extsprintf@1.3.0:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05"
+
+ extsprintf@^1.2.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f"
+
+ fast-deep-equal@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz#c053477817c86b51daa853c81e059b733d023614"
+
+ fast-json-stable-stringify@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2"
+
+ fast-levenshtein@~2.0.4:
+ version "2.0.6"
+ resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
+
+ figures@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/figures/-/figures-2.0.0.tgz#3ab1a2d2a62c8bfb431a0c94cb797a2fce27c962"
+ dependencies:
+ escape-string-regexp "^1.0.5"
+
+ file-entry-cache@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-2.0.0.tgz#c392990c3e684783d838b8c84a45d8a048458361"
+ dependencies:
+ flat-cache "^1.2.1"
+ object-assign "^4.0.1"
+
+ flat-cache@^1.2.1:
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.3.0.tgz#d3030b32b38154f4e3b7e9c709f490f7ef97c481"
+ dependencies:
+ circular-json "^0.3.1"
+ del "^2.0.2"
+ graceful-fs "^4.1.2"
+ write "^0.2.1"
+
+ forever-agent@~0.6.1:
+ version "0.6.1"
+ resolved "https://registry.yarnpkg.com/forever-agent/-/forever-agent-0.6.1.tgz#fbc71f0c41adeb37f96c577ad1ed42d8fdacca91"
+
+ form-data@~2.3.1:
+ version "2.3.2"
+ resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099"
+ dependencies:
+ asynckit "^0.4.0"
+ combined-stream "1.0.6"
+ mime-types "^2.1.12"
+
+ fs.realpath@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
+
+ functional-red-black-tree@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
+
+ getpass@^0.1.1:
+ version "0.1.7"
+ resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa"
+ dependencies:
+ assert-plus "^1.0.0"
+
+ glob@7.1.2, glob@^7.0.3, glob@^7.0.5, glob@^7.1.2:
+ version "7.1.2"
+ resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15"
+ dependencies:
+ fs.realpath "^1.0.0"
+ inflight "^1.0.4"
+ inherits "2"
+ minimatch "^3.0.4"
+ once "^1.3.0"
+ path-is-absolute "^1.0.0"
+
+ glob@^5.0.15:
+ version "5.0.15"
+ resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1"
+ dependencies:
+ inflight "^1.0.4"
+ inherits "2"
+ minimatch "2 || 3"
+ once "^1.3.0"
+ path-is-absolute "^1.0.0"
+
+ globals@^11.0.1:
+ version "11.5.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-11.5.0.tgz#6bc840de6771173b191f13d3a9c94d441ee92642"
+
+ globby@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/globby/-/globby-5.0.0.tgz#ebd84667ca0dbb330b99bcfc68eac2bc54370e0d"
+ dependencies:
+ array-union "^1.0.1"
+ arrify "^1.0.0"
+ glob "^7.0.3"
+ object-assign "^4.0.1"
+ pify "^2.0.0"
+ pinkie-promise "^2.0.0"
+
+ graceful-fs@^4.1.2:
+ version "4.1.11"
+ resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
+
+ growl@1.10.5:
+ version "1.10.5"
+ resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e"
+
+ handlebars@^4.0.1:
+ version "4.0.11"
+ resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.11.tgz#630a35dfe0294bc281edae6ffc5d329fc7982dcc"
+ dependencies:
+ async "^1.4.0"
+ optimist "^0.6.1"
+ source-map "^0.4.4"
+ optionalDependencies:
+ uglify-js "^2.6"
+
+ har-schema@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92"
+
+ har-validator@~5.0.3:
+ version "5.0.3"
+ resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd"
+ dependencies:
+ ajv "^5.1.0"
+ har-schema "^2.0.0"
+
+ has-ansi@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
+ dependencies:
+ ansi-regex "^2.0.0"
+
+ has-flag@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
+
+ has-flag@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
+
+ he@1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
+
+ http-signature@~1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
+ dependencies:
+ assert-plus "^1.0.0"
+ jsprim "^1.2.2"
+ sshpk "^1.7.0"
+
+ iconv-lite@^0.4.17:
+ version "0.4.23"
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63"
+ dependencies:
+ safer-buffer ">= 2.1.2 < 3"
+
+ ignore@^3.3.3:
+ version "3.3.8"
+ resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.8.tgz#3f8e9c35d38708a3a7e0e9abb6c73e7ee7707b2b"
+
+ imurmurhash@^0.1.4:
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
+
+ inflight@^1.0.4:
+ version "1.0.6"
+ resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
+ dependencies:
+ once "^1.3.0"
+ wrappy "1"
+
+ inherits@2, inherits@^2.0.3, inherits@~2.0.3:
+ version "2.0.3"
+ resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
+
+ inquirer@^3.0.6:
+ version "3.3.0"
+ resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-3.3.0.tgz#9dd2f2ad765dcab1ff0443b491442a20ba227dc9"
+ dependencies:
+ ansi-escapes "^3.0.0"
+ chalk "^2.0.0"
+ cli-cursor "^2.1.0"
+ cli-width "^2.0.0"
+ external-editor "^2.0.4"
+ figures "^2.0.0"
+ lodash "^4.3.0"
+ mute-stream "0.0.7"
+ run-async "^2.2.0"
+ rx-lite "^4.0.8"
+ rx-lite-aggregates "^4.0.8"
+ string-width "^2.1.0"
+ strip-ansi "^4.0.0"
+ through "^2.3.6"
+
+ is-buffer@^1.1.5:
+ version "1.1.6"
+ resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
+
+ is-fullwidth-code-point@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f"
+
+ is-path-cwd@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/is-path-cwd/-/is-path-cwd-1.0.0.tgz#d225ec23132e89edd38fda767472e62e65f1106d"
+
+ is-path-in-cwd@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz#5ac48b345ef675339bd6c7a48a912110b241cf52"
+ dependencies:
+ is-path-inside "^1.0.0"
+
+ is-path-inside@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-1.0.1.tgz#8ef5b7de50437a3fdca6b4e865ef7aa55cb48036"
+ dependencies:
+ path-is-inside "^1.0.1"
+
+ is-promise@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
+
+ is-resolvable@^1.0.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/is-resolvable/-/is-resolvable-1.1.0.tgz#fb18f87ce1feb925169c9a407c19318a3206ed88"
+
+ is-typedarray@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
+
+ isarray@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
+
+ isexe@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
+
+ isstream@~0.1.2:
+ version "0.1.2"
+ resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"
+
+ istanbul@^0.4.5:
+ version "0.4.5"
+ resolved "https://registry.yarnpkg.com/istanbul/-/istanbul-0.4.5.tgz#65c7d73d4c4da84d4f3ac310b918fb0b8033733b"
+ dependencies:
+ abbrev "1.0.x"
+ async "1.x"
+ escodegen "1.8.x"
+ esprima "2.7.x"
+ glob "^5.0.15"
+ handlebars "^4.0.1"
+ js-yaml "3.x"
+ mkdirp "0.5.x"
+ nopt "3.x"
+ once "1.x"
+ resolve "1.1.x"
+ supports-color "^3.1.0"
+ which "^1.1.1"
+ wordwrap "^1.0.0"
+
+ js-tokens@^3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b"
+
+ js-yaml@3.x, js-yaml@^3.6.1, js-yaml@^3.9.1:
+ version "3.12.0"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.12.0.tgz#eaed656ec8344f10f527c6bfa1b6e2244de167d1"
+ dependencies:
+ argparse "^1.0.7"
+ esprima "^4.0.0"
+
+ jsbn@~0.1.0:
+ version "0.1.1"
+ resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513"
+
+ json-schema-traverse@^0.3.0:
+ version "0.3.1"
+ resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
+
+ json-schema@0.2.3:
+ version "0.2.3"
+ resolved "https://registry.yarnpkg.com/json-schema/-/json-schema-0.2.3.tgz#b480c892e59a2f05954ce727bd3f2a4e882f9e13"
+
+ json-stable-stringify-without-jsonify@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
+
+ json-stringify-safe@~5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb"
+
+ jsprim@^1.2.2:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
+ dependencies:
+ assert-plus "1.0.0"
+ extsprintf "1.3.0"
+ json-schema "0.2.3"
+ verror "1.10.0"
+
+ kind-of@^3.0.2:
+ version "3.2.2"
+ resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
+ dependencies:
+ is-buffer "^1.1.5"
+
+ lazy-cache@^1.0.3:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-1.0.4.tgz#a1d78fc3a50474cb80845d3b3b6e1da49a446e8e"
+
+ lcov-parse@^0.0.10:
+ version "0.0.10"
+ resolved "https://registry.yarnpkg.com/lcov-parse/-/lcov-parse-0.0.10.tgz#1b0b8ff9ac9c7889250582b70b71315d9da6d9a3"
+
+ levn@^0.3.0, levn@~0.3.0:
+ version "0.3.0"
+ resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee"
+ dependencies:
+ prelude-ls "~1.1.2"
+ type-check "~0.3.2"
+
+ lodash@^4.17.4, lodash@^4.3.0:
+ version "4.17.10"
+ resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.10.tgz#1b7793cf7259ea38fb3661d4d38b3260af8ae4e7"
+
+ log-driver@^1.2.5:
+ version "1.2.7"
+ resolved "https://registry.yarnpkg.com/log-driver/-/log-driver-1.2.7.tgz#63b95021f0702fedfa2c9bb0a24e7797d71871d8"
+
+ longest@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"
+
+ lru-cache@^4.0.1:
+ version "4.1.3"
+ resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.3.tgz#a1175cf3496dfc8436c156c334b4955992bce69c"
+ dependencies:
+ pseudomap "^1.0.2"
+ yallist "^2.1.2"
+
+ mime-db@~1.33.0:
+ version "1.33.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.33.0.tgz#a3492050a5cb9b63450541e39d9788d2272783db"
+
+ mime-types@^2.1.12, mime-types@~2.1.17:
+ version "2.1.18"
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.18.tgz#6f323f60a83d11146f831ff11fd66e2fe5503bb8"
+ dependencies:
+ mime-db "~1.33.0"
+
+ mimic-fn@^1.0.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
+
+ "minimatch@2 || 3", minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4:
+ version "3.0.4"
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
+ dependencies:
+ brace-expansion "^1.1.7"
+
+ minimist@0.0.8:
+ version "0.0.8"
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d"
+
+ minimist@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284"
+
+ minimist@~0.0.1:
+ version "0.0.10"
+ resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf"
+
+ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.1:
+ version "0.5.1"
+ resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903"
+ dependencies:
+ minimist "0.0.8"
+
+ mocha@^5.2.0:
+ version "5.2.0"
+ resolved "https://registry.yarnpkg.com/mocha/-/mocha-5.2.0.tgz#6d8ae508f59167f940f2b5b3c4a612ae50c90ae6"
+ dependencies:
+ browser-stdout "1.3.1"
+ commander "2.15.1"
+ debug "3.1.0"
+ diff "3.5.0"
+ escape-string-regexp "1.0.5"
+ glob "7.1.2"
+ growl "1.10.5"
+ he "1.1.1"
+ minimatch "3.0.4"
+ mkdirp "0.5.1"
+ supports-color "5.4.0"
+
+ ms@2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
+
+ mute-stream@0.0.7:
+ version "0.0.7"
+ resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
+
+ natural-compare@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
+
+ nopt@3.x:
+ version "3.0.6"
+ resolved "https://registry.yarnpkg.com/nopt/-/nopt-3.0.6.tgz#c6465dbf08abcd4db359317f79ac68a646b28ff9"
+ dependencies:
+ abbrev "1"
+
+ oauth-sign@~0.8.2:
+ version "0.8.2"
+ resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43"
+
+ object-assign@^4.0.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
+
+ once@1.x, once@^1.3.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
+ dependencies:
+ wrappy "1"
+
+ onetime@^2.0.0:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/onetime/-/onetime-2.0.1.tgz#067428230fd67443b2794b22bba528b6867962d4"
+ dependencies:
+ mimic-fn "^1.0.0"
+
+ optimist@^0.6.1:
+ version "0.6.1"
+ resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
+ dependencies:
+ minimist "~0.0.1"
+ wordwrap "~0.0.2"
+
+ optionator@^0.8.1, optionator@^0.8.2:
+ version "0.8.2"
+ resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64"
+ dependencies:
+ deep-is "~0.1.3"
+ fast-levenshtein "~2.0.4"
+ levn "~0.3.0"
+ prelude-ls "~1.1.2"
+ type-check "~0.3.2"
+ wordwrap "~1.0.0"
+
+ os-tmpdir@~1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
+
+ path-is-absolute@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
+
+ path-is-inside@^1.0.1, path-is-inside@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53"
+
+ performance-now@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
+
+ pify@^2.0.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
+
+ pinkie-promise@^2.0.0:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/pinkie-promise/-/pinkie-promise-2.0.1.tgz#2135d6dfa7a358c069ac9b178776288228450ffa"
+ dependencies:
+ pinkie "^2.0.0"
+
+ pinkie@^2.0.0:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
+
+ pluralize@^7.0.0:
+ version "7.0.0"
+ resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-7.0.0.tgz#298b89df8b93b0221dbf421ad2b1b1ea23fc6777"
+
+ prelude-ls@~1.1.2:
+ version "1.1.2"
+ resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
+
+ process-nextick-args@~2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.0.tgz#a37d732f4271b4ab1ad070d35508e8290788ffaa"
+
+ progress@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f"
+
+ pseudomap@^1.0.2:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
+
+ punycode@^1.4.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e"
+
+ qs@~6.5.1:
+ version "6.5.2"
+ resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
+
+ readable-stream@^2.2.2:
+ version "2.3.6"
+ resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
+ dependencies:
+ core-util-is "~1.0.0"
+ inherits "~2.0.3"
+ isarray "~1.0.0"
+ process-nextick-args "~2.0.0"
+ safe-buffer "~5.1.1"
+ string_decoder "~1.1.1"
+ util-deprecate "~1.0.1"
+
+ regexpp@^1.0.1:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-1.1.0.tgz#0e3516dd0b7904f413d2d4193dce4618c3a689ab"
+
+ repeat-string@^1.5.2:
+ version "1.6.1"
+ resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
+
+ request@^2.79.0:
+ version "2.87.0"
+ resolved "https://registry.yarnpkg.com/request/-/request-2.87.0.tgz#32f00235cd08d482b4d0d68db93a829c0ed5756e"
+ dependencies:
+ aws-sign2 "~0.7.0"
+ aws4 "^1.6.0"
+ caseless "~0.12.0"
+ combined-stream "~1.0.5"
+ extend "~3.0.1"
+ forever-agent "~0.6.1"
+ form-data "~2.3.1"
+ har-validator "~5.0.3"
+ http-signature "~1.2.0"
+ is-typedarray "~1.0.0"
+ isstream "~0.1.2"
+ json-stringify-safe "~5.0.1"
+ mime-types "~2.1.17"
+ oauth-sign "~0.8.2"
+ performance-now "^2.1.0"
+ qs "~6.5.1"
+ safe-buffer "^5.1.1"
+ tough-cookie "~2.3.3"
+ tunnel-agent "^0.6.0"
+ uuid "^3.1.0"
+
+ require-uncached@^1.0.3:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/require-uncached/-/require-uncached-1.0.3.tgz#4e0d56d6c9662fd31e43011c4b95aa49955421d3"
+ dependencies:
+ caller-path "^0.1.0"
+ resolve-from "^1.0.0"
+
+ resolve-from@^1.0.0:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
+
+ resolve@1.1.x:
+ version "1.1.7"
+ resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"
+
+ restore-cursor@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-2.0.0.tgz#9f7ee287f82fd326d4fd162923d62129eee0dfaf"
+ dependencies:
+ onetime "^2.0.0"
+ signal-exit "^3.0.2"
+
+ right-align@^0.1.1:
+ version "0.1.3"
+ resolved "https://registry.yarnpkg.com/right-align/-/right-align-0.1.3.tgz#61339b722fe6a3515689210d24e14c96148613ef"
+ dependencies:
+ align-text "^0.1.1"
+
+ rimraf@^2.2.8:
+ version "2.6.2"
+ resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36"
+ dependencies:
+ glob "^7.0.5"
+
+ run-async@^2.2.0:
+ version "2.3.0"
+ resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0"
+ dependencies:
+ is-promise "^2.1.0"
+
+ rx-lite-aggregates@^4.0.8:
+ version "4.0.8"
+ resolved "https://registry.yarnpkg.com/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz#753b87a89a11c95467c4ac1626c4efc4e05c67be"
+ dependencies:
+ rx-lite "*"
+
+ rx-lite@*, rx-lite@^4.0.8:
+ version "4.0.8"
+ resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-4.0.8.tgz#0b1e11af8bc44836f04a6407e92da42467b79444"
+
+ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
+ version "5.1.2"
+ resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
+
+ "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2:
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
+
+ semver@^5.3.0:
+ version "5.5.0"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-5.5.0.tgz#dc4bbc7a6ca9d916dee5d43516f0092b58f7b8ab"
+
+ shebang-command@^1.2.0:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
+ dependencies:
+ shebang-regex "^1.0.0"
+
+ shebang-regex@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
+
+ should-equal@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3"
+ dependencies:
+ should-type "^1.4.0"
+
+ should-format@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
+ dependencies:
+ should-type "^1.3.0"
+ should-type-adaptors "^1.0.1"
+
+ should-type-adaptors@^1.0.1:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
+ dependencies:
+ should-type "^1.3.0"
+ should-util "^1.0.0"
+
+ should-type@^1.3.0, should-type@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
+
+ should-util@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063"
+
+ should@^13.2.1:
+ version "13.2.1"
+ resolved "https://registry.yarnpkg.com/should/-/should-13.2.1.tgz#84e6ebfbb145c79e0ae42307b25b3f62dcaf574e"
+ dependencies:
+ should-equal "^2.0.0"
+ should-format "^3.0.3"
+ should-type "^1.4.0"
+ should-type-adaptors "^1.0.1"
+ should-util "^1.0.0"
+
+ signal-exit@^3.0.2:
+ version "3.0.2"
+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
+
+ slice-ansi@1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-1.0.0.tgz#044f1a49d8842ff307aad6b505ed178bd950134d"
+ dependencies:
+ is-fullwidth-code-point "^2.0.0"
+
+ source-map@^0.4.4:
+ version "0.4.4"
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b"
+ dependencies:
+ amdefine ">=0.0.4"
+
+ source-map@~0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.2.0.tgz#dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d"
+ dependencies:
+ amdefine ">=0.0.4"
+
+ source-map@~0.5.1:
+ version "0.5.7"
+ resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
+
+ sprintf-js@~1.0.2:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
+
+ sshpk@^1.7.0:
+ version "1.14.2"
+ resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.14.2.tgz#c6fc61648a3d9c4e764fd3fcdf4ea105e492ba98"
+ dependencies:
+ asn1 "~0.2.3"
+ assert-plus "^1.0.0"
+ dashdash "^1.12.0"
+ getpass "^0.1.1"
+ safer-buffer "^2.0.2"
+ optionalDependencies:
+ bcrypt-pbkdf "^1.0.0"
+ ecc-jsbn "~0.1.1"
+ jsbn "~0.1.0"
+ tweetnacl "~0.14.0"
+
+ string-width@^2.1.0, string-width@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e"
+ dependencies:
+ is-fullwidth-code-point "^2.0.0"
+ strip-ansi "^4.0.0"
+
+ string_decoder@~1.1.1:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
+ dependencies:
+ safe-buffer "~5.1.0"
+
+ strip-ansi@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
+ dependencies:
+ ansi-regex "^2.0.0"
+
+ strip-ansi@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f"
+ dependencies:
+ ansi-regex "^3.0.0"
+
+ strip-json-comments@~2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a"
+
+ supports-color@5.4.0, supports-color@^5.3.0:
+ version "5.4.0"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.4.0.tgz#1c6b337402c2137605efe19f10fec390f6faab54"
+ dependencies:
+ has-flag "^3.0.0"
+
+ supports-color@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
+
+ supports-color@^3.1.0:
+ version "3.2.3"
+ resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6"
+ dependencies:
+ has-flag "^1.0.0"
+
+ table@4.0.2:
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/table/-/table-4.0.2.tgz#a33447375391e766ad34d3486e6e2aedc84d2e36"
+ dependencies:
+ ajv "^5.2.3"
+ ajv-keywords "^2.1.0"
+ chalk "^2.1.0"
+ lodash "^4.17.4"
+ slice-ansi "1.0.0"
+ string-width "^2.1.1"
+
+ text-table@~0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
+
+ through@^2.3.6:
+ version "2.3.8"
+ resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
+
+ tmp@^0.0.33:
+ version "0.0.33"
+ resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
+ dependencies:
+ os-tmpdir "~1.0.2"
+
+ tough-cookie@~2.3.3:
+ version "2.3.4"
+ resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655"
+ dependencies:
+ punycode "^1.4.1"
+
+ tunnel-agent@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd"
+ dependencies:
+ safe-buffer "^5.0.1"
+
+ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
+ version "0.14.5"
+ resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
+
+ type-check@~0.3.2:
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.3.2.tgz#5884cab512cf1d355e3fb784f30804b2b520db72"
+ dependencies:
+ prelude-ls "~1.1.2"
+
+ typedarray@^0.0.6:
+ version "0.0.6"
+ resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
+
+ uglify-js@^2.6:
+ version "2.8.29"
+ resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd"
+ dependencies:
+ source-map "~0.5.1"
+ yargs "~3.10.0"
+ optionalDependencies:
+ uglify-to-browserify "~1.0.0"
+
+ uglify-to-browserify@~1.0.0:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7"
+
+ util-deprecate@~1.0.1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
+
+ uuid@^3.1.0:
+ version "3.2.1"
+ resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14"
+
+ verror@1.10.0:
+ version "1.10.0"
+ resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
+ dependencies:
+ assert-plus "^1.0.0"
+ core-util-is "1.0.2"
+ extsprintf "^1.2.0"
+
+ which@^1.1.1, which@^1.2.9:
+ version "1.3.1"
+ resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
+ dependencies:
+ isexe "^2.0.0"
+
+ window-size@0.1.0:
+ version "0.1.0"
+ resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d"
+
+ wordwrap@0.0.2:
+ version "0.0.2"
+ resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f"
+
+ wordwrap@^1.0.0, wordwrap@~1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
+
+ wordwrap@~0.0.2:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107"
+
+ wrappy@1:
+ version "1.0.2"
+ resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
+
+ write@^0.2.1:
+ version "0.2.1"
+ resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757"
+ dependencies:
+ mkdirp "^0.5.1"
+
+ yallist@^2.1.2:
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"
+
+ yargs@~3.10.0:
+ version "3.10.0"
+ resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.10.0.tgz#f7ee7bd857dd7c1d2d38c0e74efbd681d1431fd1"
+ dependencies:
+ camelcase "^1.0.2"
+ cliui "^2.1.0"
+ decamelize "^1.0.0"
+ window-size "0.1.0"
+
+Trace:
+ Error: Command failed.
+ Exit code: 1
+ Command: sh
+ Arguments: -c mocha --require coffeescript/register
+ Directory: /src/qix-/node-is-arrayish
+ Output:
+
+ at ProcessTermError.MessageError (/Users/junon/.yarn/lib/cli.js:186:110)
+ at new ProcessTermError (/Users/junon/.yarn/lib/cli.js:226:113)
+ at ChildProcess. (/Users/junon/.yarn/lib/cli.js:30281:17)
+ at ChildProcess.emit (events.js:127:13)
+ at maybeClose (internal/child_process.js:933:16)
+ at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
diff --git a/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/LICENSE b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/LICENSE
new file mode 100644
index 0000000..1b77e5b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Josh Junon
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/README.md b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/README.md
new file mode 100644
index 0000000..7624577
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/README.md
@@ -0,0 +1,39 @@
+# simple-swizzle [](https://travis-ci.org/Qix-/node-simple-swizzle) [](https://coveralls.io/r/Qix-/node-simple-swizzle)
+
+> [Swizzle](https://en.wikipedia.org/wiki/Swizzling_(computer_graphics)) your function arguments; pass in mixed arrays/values and get a clean array
+
+## Usage
+
+```js
+var swizzle = require('simple-swizzle');
+
+function myFunc() {
+ var args = swizzle(arguments);
+ // ...
+ return args;
+}
+
+myFunc(1, [2, 3], 4); // [1, 2, 3, 4]
+myFunc(1, 2, 3, 4); // [1, 2, 3, 4]
+myFunc([1, 2, 3, 4]); // [1, 2, 3, 4]
+```
+
+Functions can also be wrapped to automatically swizzle arguments and be passed
+the resulting array.
+
+```js
+var swizzle = require('simple-swizzle');
+
+var swizzledFn = swizzle.wrap(function (args) {
+ // ...
+ return args;
+});
+
+swizzledFn(1, [2, 3], 4); // [1, 2, 3, 4]
+swizzledFn(1, 2, 3, 4); // [1, 2, 3, 4]
+swizzledFn([1, 2, 3, 4]); // [1, 2, 3, 4]
+```
+
+## License
+Licensed under the [MIT License](http://opensource.org/licenses/MIT).
+You can find a copy of it in [LICENSE](LICENSE).
diff --git a/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/index.js b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/index.js
new file mode 100644
index 0000000..366b9ec
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/index.js
@@ -0,0 +1,29 @@
+'use strict';
+
+import isArrayish from '../is-arrayish';
+
+var concat = Array.prototype.concat;
+var slice = Array.prototype.slice;
+
+export default function swizzle(args) {
+ var results = [];
+
+ for (var i = 0, len = args.length; i < len; i++) {
+ var arg = args[i];
+
+ if (isArrayish(arg)) {
+ // http://jsperf.com/javascript-array-concat-vs-push/98
+ results = concat.call(results, slice.call(arg));
+ } else {
+ results.push(arg);
+ }
+ }
+
+ return results;
+};
+
+swizzle.wrap = function (fn) {
+ return function () {
+ return fn(swizzle(arguments));
+ };
+};
diff --git a/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/package.json b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/package.json
new file mode 100644
index 0000000..795ae4c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/color/simple-swizzle/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "simple-swizzle",
+ "description": "Simply swizzle your arguments",
+ "version": "0.2.2",
+ "author": "Qix (http://github.com/qix-)",
+ "keywords": [
+ "argument",
+ "arguments",
+ "swizzle",
+ "swizzling",
+ "parameter",
+ "parameters",
+ "mixed",
+ "array"
+ ],
+ "license": "MIT",
+ "scripts": {
+ "pretest": "xo",
+ "test": "mocha --compilers coffee:coffee-script/register"
+ },
+ "files": [
+ "index.js"
+ ],
+ "repository": "qix-/node-simple-swizzle",
+ "devDependencies": {
+ "coffee-script": "^1.9.3",
+ "coveralls": "^2.11.2",
+ "istanbul": "^0.3.17",
+ "mocha": "^2.2.5",
+ "should": "^7.0.1",
+ "xo": "^0.7.1"
+ },
+ "dependencies": {
+ "is-arrayish": "^0.3.1"
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/debounce.js b/uni_modules/wu-ui-tools/libs/function/debounce.js
new file mode 100644
index 0000000..ad3996b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/debounce.js
@@ -0,0 +1,29 @@
+let timeout = null
+
+/**
+ * 防抖原理:一定时间内,只有最后一次操作,再过wait毫秒后才执行函数
+ *
+ * @param {Function} func 要执行的回调函数
+ * @param {Number} wait 延时的时间
+ * @param {Boolean} immediate 是否立即执行
+ * @return null
+ */
+function debounce(func, wait = 500, immediate = false) {
+ // 清除定时器
+ if (timeout !== null) clearTimeout(timeout)
+ // 立即执行,此类情况一般用不到
+ if (immediate) {
+ const callNow = !timeout
+ timeout = setTimeout(() => {
+ timeout = null
+ }, wait)
+ if (callNow) typeof func === 'function' && func()
+ } else {
+ // 设置定时器,当最后一次操作后,timeout不会再被清除,所以在延时wait毫秒后执行func回调方法
+ timeout = setTimeout(() => {
+ typeof func === 'function' && func()
+ }, wait)
+ }
+}
+
+export default debounce
diff --git a/uni_modules/wu-ui-tools/libs/function/digit.js b/uni_modules/wu-ui-tools/libs/function/digit.js
new file mode 100644
index 0000000..c8260a0
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/digit.js
@@ -0,0 +1,167 @@
+let _boundaryCheckingState = true; // 是否进行越界检查的全局开关
+
+/**
+ * 把错误的数据转正
+ * @private
+ * @example strip(0.09999999999999998)=0.1
+ */
+function strip(num, precision = 15) {
+ return +parseFloat(Number(num).toPrecision(precision));
+}
+
+/**
+ * Return digits length of a number
+ * @private
+ * @param {*number} num Input number
+ */
+function digitLength(num) {
+ // Get digit length of e
+ const eSplit = num.toString().split(/[eE]/);
+ const len = (eSplit[0].split('.')[1] || '').length - +(eSplit[1] || 0);
+ return len > 0 ? len : 0;
+}
+
+/**
+ * 把小数转成整数,如果是小数则放大成整数
+ * @private
+ * @param {*number} num 输入数
+ */
+function float2Fixed(num) {
+ if (num.toString().indexOf('e') === -1) {
+ return Number(num.toString().replace('.', ''));
+ }
+ const dLen = digitLength(num);
+ return dLen > 0 ? strip(Number(num) * Math.pow(10, dLen)) : Number(num);
+}
+
+/**
+ * 检测数字是否越界,如果越界给出提示
+ * @private
+ * @param {*number} num 输入数
+ */
+function checkBoundary(num) {
+ if (_boundaryCheckingState) {
+ if (num > Number.MAX_SAFE_INTEGER || num < Number.MIN_SAFE_INTEGER) {
+ console.warn(`${num} 超出了精度限制,结果可能不正确`);
+ }
+ }
+}
+
+/**
+ * 把递归操作扁平迭代化
+ * @param {number[]} arr 要操作的数字数组
+ * @param {function} operation 迭代操作
+ * @private
+ */
+function iteratorOperation(arr, operation) {
+ const [num1, num2, ...others] = arr;
+ let res = operation(num1, num2);
+
+ others.forEach((num) => {
+ res = operation(res, num);
+ });
+
+ return res;
+}
+
+/**
+ * 高精度乘法
+ * @export
+ */
+export function times(...nums) {
+ if (nums.length > 2) {
+ return iteratorOperation(nums, times);
+ }
+
+ const [num1, num2] = nums;
+ const num1Changed = float2Fixed(num1);
+ const num2Changed = float2Fixed(num2);
+ const baseNum = digitLength(num1) + digitLength(num2);
+ const leftValue = num1Changed * num2Changed;
+
+ checkBoundary(leftValue);
+
+ return leftValue / Math.pow(10, baseNum);
+}
+
+/**
+ * 高精度加法
+ * @export
+ */
+export function plus(...nums) {
+ if (nums.length > 2) {
+ return iteratorOperation(nums, plus);
+ }
+
+ const [num1, num2] = nums;
+ // 取最大的小数位
+ const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
+ // 把小数都转为整数然后再计算
+ return (times(num1, baseNum) + times(num2, baseNum)) / baseNum;
+}
+
+/**
+ * 高精度减法
+ * @export
+ */
+export function minus(...nums) {
+ if (nums.length > 2) {
+ return iteratorOperation(nums, minus);
+ }
+
+ const [num1, num2] = nums;
+ const baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
+ return (times(num1, baseNum) - times(num2, baseNum)) / baseNum;
+}
+
+/**
+ * 高精度除法
+ * @export
+ */
+export function divide(...nums) {
+ if (nums.length > 2) {
+ return iteratorOperation(nums, divide);
+ }
+
+ const [num1, num2] = nums;
+ const num1Changed = float2Fixed(num1);
+ const num2Changed = float2Fixed(num2);
+ checkBoundary(num1Changed);
+ checkBoundary(num2Changed);
+ // 重要,这里必须用strip进行修正
+ return times(num1Changed / num2Changed, strip(Math.pow(10, digitLength(num2) - digitLength(num1))));
+}
+
+/**
+ * 四舍五入
+ * @export
+ */
+export function round(num, ratio) {
+ const base = Math.pow(10, ratio);
+ let result = divide(Math.round(Math.abs(times(num, base))), base);
+ if (num < 0 && result !== 0) {
+ result = times(result, -1);
+ }
+ // 位数不足则补0
+ return result;
+}
+
+/**
+ * 是否进行边界检查,默认开启
+ * @param flag 标记开关,true 为开启,false 为关闭,默认为 true
+ * @export
+ */
+export function enableBoundaryChecking(flag = true) {
+ _boundaryCheckingState = flag;
+}
+
+
+export default {
+ times,
+ plus,
+ minus,
+ divide,
+ round,
+ enableBoundaryChecking,
+};
+
diff --git a/uni_modules/wu-ui-tools/libs/function/index.js b/uni_modules/wu-ui-tools/libs/function/index.js
new file mode 100644
index 0000000..d9bad2d
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/index.js
@@ -0,0 +1,738 @@
+import { number, empty } from './test.js'
+import { round } from './digit.js'
+// 颜色操作方法
+import Color from './color'
+
+/**
+ * @description 如果value小于min,取min;如果value大于max,取max
+ * @param {number} min
+ * @param {number} max
+ * @param {number} value
+ */
+function range(min = 0, max = 0, value = 0) {
+ return Math.max(min, Math.min(max, Number(value)))
+}
+
+/**
+ * @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换
+ * @param {number|string} value 用户传递值的px值
+ * @param {boolean} unit
+ * @returns {number|string}
+ */
+function getPx(value, unit = false) {
+ if (number(value)) {
+ return unit ? `${value}px` : Number(value)
+ }
+ // 如果带有rpx,先取出其数值部分,再转为px值
+ if (/(rpx|upx)$/.test(value)) {
+ return unit ? `${uni.upx2px(parseInt(value))}px` : Number(uni.upx2px(parseInt(value)))
+ }
+ return unit ? `${parseInt(value)}px` : parseInt(value)
+}
+
+/**
+ * @description 进行延时,以达到可以简写代码的目的 比如: await uni.$w.sleep(20)将会阻塞20ms
+ * @param {number} value 堵塞时间 单位ms 毫秒
+ * @returns {Promise} 返回promise
+ */
+function sleep(value = 30) {
+ return new Promise((resolve) => {
+ setTimeout(() => {
+ resolve()
+ }, value)
+ })
+}
+/**
+ * @description 运行期判断平台
+ * @returns {string} 返回所在平台(小写)
+ * @link 运行期判断平台 https://uniapp.dcloud.io/frame?id=判断平台
+ */
+function os() {
+ return uni.getSystemInfoSync().platform.toLowerCase()
+}
+/**
+ * @description 获取系统信息同步接口
+ * @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
+ */
+function sys() {
+ return uni.getSystemInfoSync()
+}
+
+/**
+ * @description 取一个区间数
+ * @param {Number} min 最小值
+ * @param {Number} max 最大值
+ */
+function random(min, max) {
+ if (min >= 0 && max > 0 && max >= min) {
+ const gab = max - min + 1
+ return Math.floor(Math.random() * gab + min)
+ }
+ return 0
+}
+
+/**
+ * @param {Number} len uuid的长度
+ * @param {Boolean} firstU 将返回的首字母置为"u"
+ * @param {Nubmer} radix 生成uuid的基数(意味着返回的字符串都是这个基数),2-二进制,8-八进制,10-十进制,16-十六进制
+ */
+function guid(len = 32, firstU = true, radix = null) {
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('')
+ const uuid = []
+ radix = radix || chars.length
+
+ if (len) {
+ // 如果指定uuid长度,只是取随机的字符,0|x为位运算,能去掉x的小数位,返回整数位
+ for (let i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix]
+ } else {
+ let r
+ // rfc4122标准要求返回的uuid中,某些位为固定的字符
+ uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
+ uuid[14] = '4'
+
+ for (let i = 0; i < 36; i++) {
+ if (!uuid[i]) {
+ r = 0 | Math.random() * 16
+ uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r]
+ }
+ }
+ }
+ // 移除第一个字符,并用u替代,因为第一个字符为数值时,该guuid不能用作id或者class
+ if (firstU) {
+ uuid.shift()
+ return `u${uuid.join('')}`
+ }
+ return uuid.join('')
+}
+
+/**
+* @description 获取父组件的参数,因为支付宝小程序不支持provide/inject的写法
+ this.$parent在非H5中,可以准确获取到父组件,但是在H5中,需要多次this.$parent.$parent.xxx
+ 这里默认值等于undefined有它的含义,因为最顶层元素(组件)的$parent就是undefined,意味着不传name
+ 值(默认为undefined),就是查找最顶层的$parent
+* @param {string|undefined} name 父组件的参数名
+*/
+function $parent(name = undefined) {
+ let parent = this.$parent
+ // 通过while历遍,这里主要是为了H5需要多层解析的问题
+ while (parent) {
+ // 父组件
+ if (parent.$options && parent.$options.name !== name) {
+ // 如果组件的name不相等,继续上一级寻找
+ parent = parent.$parent
+ } else {
+ return parent
+ }
+ }
+ return false
+}
+
+/**
+ * @description 样式转换
+ * 对象转字符串,或者字符串转对象
+ * @param {object | string} customStyle 需要转换的目标
+ * @param {String} target 转换的目的,object-转为对象,string-转为字符串
+ * @returns {object|string}
+ */
+function addStyle(customStyle, target = 'object') {
+ // 字符串转字符串,对象转对象情形,直接返回
+ if (empty(customStyle) || typeof(customStyle) === 'object' && target === 'object' || target === 'string' &&
+ typeof(customStyle) === 'string') {
+ return customStyle
+ }
+ // 字符串转对象
+ if (target === 'object') {
+ // 去除字符串样式中的两端空格(中间的空格不能去掉,比如padding: 20px 0如果去掉了就错了),空格是无用的
+ customStyle = trim(customStyle)
+ // 根据";"将字符串转为数组形式
+ const styleArray = customStyle.split(';')
+ const style = {}
+ // 历遍数组,拼接成对象
+ for (let i = 0; i < styleArray.length; i++) {
+ // 'font-size:20px;color:red;',如此最后字符串有";"的话,会导致styleArray最后一个元素为空字符串,这里需要过滤
+ if (styleArray[i]) {
+ const item = styleArray[i].split(':')
+ style[trim(item[0])] = trim(item[1])
+ }
+ }
+ return style
+ }
+ // 这里为对象转字符串形式
+ let string = ''
+ for (const i in customStyle) {
+ // 驼峰转为中划线的形式,否则css内联样式,无法识别驼峰样式属性名
+ const key = i.replace(/([A-Z])/g, '-$1').toLowerCase()
+ string += `${key}:${customStyle[i]};`
+ }
+ // 去除两端空格
+ return trim(string)
+}
+
+/**
+ * @description 添加单位,如果有rpx,upx,%,px等单位结尾或者值为auto,直接返回,否则加上px单位结尾
+ * @param {string|number} value 需要添加单位的值
+ * @param {string} unit 添加的单位名 比如px
+ */
+function addUnit(value = 'auto', unit = uni?.$w?.config?.unit ? uni?.$w?.config?.unit : 'px') {
+ value = String(value)
+ // 用wuui内置验证规则中的number判断是否为数值
+ return number(value) ? `${value}${unit}` : value
+}
+
+/**
+ * @description 深度克隆
+ * @param {object} obj 需要深度克隆的对象
+ * @param cache 缓存
+ * @returns {*} 克隆后的对象或者原值(不是对象)
+ */
+function deepClone(obj, cache = new WeakMap()) {
+ if (obj === null || typeof obj !== 'object') return obj;
+ if (cache.has(obj)) return cache.get(obj);
+ let clone;
+ if (obj instanceof Date) {
+ clone = new Date(obj.getTime());
+ } else if (obj instanceof RegExp) {
+ clone = new RegExp(obj);
+ } else if (obj instanceof Map) {
+ clone = new Map(Array.from(obj, ([key, value]) => [key, deepClone(value, cache)]));
+ } else if (obj instanceof Set) {
+ clone = new Set(Array.from(obj, value => deepClone(value, cache)));
+ } else if (Array.isArray(obj)) {
+ clone = obj.map(value => deepClone(value, cache));
+ } else if (Object.prototype.toString.call(obj) === '[object Object]') {
+ clone = Object.create(Object.getPrototypeOf(obj));
+ cache.set(obj, clone);
+ for (const [key, value] of Object.entries(obj)) {
+ clone[key] = deepClone(value, cache);
+ }
+ } else {
+ clone = Object.assign({}, obj);
+ }
+ cache.set(obj, clone);
+ return clone;
+}
+
+/**
+ * @description JS对象深度合并
+ * @param {object} target 需要拷贝的对象
+ * @param {object} source 拷贝的来源对象
+ * @returns {object|boolean} 深度合并后的对象或者false(入参有不是对象)
+ */
+function deepMerge(target = {}, source = {}) {
+ target = deepClone(target)
+ if (typeof target !== 'object' || target === null || typeof source !== 'object' || source === null) return target;
+ const merged = Array.isArray(target) ? target.slice() : Object.assign({}, target);
+ for (const prop in source) {
+ if (!source.hasOwnProperty(prop)) continue;
+ const sourceValue = source[prop];
+ const targetValue = merged[prop];
+ if (sourceValue instanceof Date) {
+ merged[prop] = new Date(sourceValue);
+ } else if (sourceValue instanceof RegExp) {
+ merged[prop] = new RegExp(sourceValue);
+ } else if (sourceValue instanceof Map) {
+ merged[prop] = new Map(sourceValue);
+ } else if (sourceValue instanceof Set) {
+ merged[prop] = new Set(sourceValue);
+ } else if (typeof sourceValue === 'object' && sourceValue !== null) {
+ merged[prop] = deepMerge(targetValue, sourceValue);
+ } else {
+ merged[prop] = sourceValue;
+ }
+ }
+ return merged;
+}
+
+/**
+ * @description error提示
+ * @param {*} err 错误内容
+ */
+function error(err) {
+ // 开发环境才提示,生产环境不会提示
+ if (process.env.NODE_ENV === 'development') {
+ console.error(`wuui提示:${err}`)
+ }
+}
+
+/**
+ * @description 打乱数组
+ * @param {array} array 需要打乱的数组
+ * @returns {array} 打乱后的数组
+ */
+function randomArray(array = []) {
+ // 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
+ return array.sort(() => Math.random() - 0.5)
+}
+
+// padStart 的 polyfill,因为某些机型或情况,还无法支持es7的padStart,比如电脑版的微信小程序
+// 所以这里做一个兼容polyfill的兼容处理
+if (!String.prototype.padStart) {
+ // 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
+ String.prototype.padStart = function(maxLength, fillString = ' ') {
+ if (Object.prototype.toString.call(fillString) !== '[object String]') {
+ throw new TypeError(
+ 'fillString must be String'
+ )
+ }
+ const str = this
+ // 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
+ if (str.length >= maxLength) return String(str)
+
+ const fillLength = maxLength - str.length
+ let times = Math.ceil(fillLength / fillString.length)
+ while (times >>= 1) {
+ fillString += fillString
+ if (times === 1) {
+ fillString += fillString
+ }
+ }
+ return fillString.slice(0, fillLength) + str
+ }
+}
+
+/**
+ * @description 格式化时间
+ * @param {String|Number} dateTime 需要格式化的时间戳
+ * @param {String} fmt 格式化规则 yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合 默认yyyy-mm-dd
+ * @returns {string} 返回格式化后的字符串
+ */
+function timeFormat(dateTime = null, formatStr = 'yyyy-mm-dd') {
+ let date
+ // 若传入时间为假值,则取当前时间
+ if (!dateTime) {
+ date = new Date()
+ }
+ // 若为unix秒时间戳,则转为毫秒时间戳(逻辑有点奇怪,但不敢改,以保证历史兼容)
+ else if (/^\d{10}$/.test(dateTime?.toString().trim())) {
+ date = new Date(dateTime * 1000)
+ }
+ // 若用户传入字符串格式时间戳,new Date无法解析,需做兼容
+ else if (typeof dateTime === 'string' && /^\d+$/.test(dateTime.trim())) {
+ date = new Date(Number(dateTime))
+ }
+ // 处理平台性差异,在Safari/Webkit中,new Date仅支持/作为分割符的字符串时间
+ // 处理 '2022-07-10 01:02:03',跳过 '2022-07-10T01:02:03'
+ else if (typeof dateTime === 'string' && dateTime.includes('-') && !dateTime.includes('T')) {
+ date = new Date(dateTime.replace(/-/g, '/'))
+ }
+ // 其他都认为符合 RFC 2822 规范
+ else {
+ date = new Date(dateTime)
+ }
+
+ const timeSource = {
+ 'y': date.getFullYear().toString(), // 年
+ 'm': (date.getMonth() + 1).toString().padStart(2, '0'), // 月
+ 'd': date.getDate().toString().padStart(2, '0'), // 日
+ 'h': date.getHours().toString().padStart(2, '0'), // 时
+ 'M': date.getMinutes().toString().padStart(2, '0'), // 分
+ 's': date.getSeconds().toString().padStart(2, '0') // 秒
+ // 有其他格式化字符需求可以继续添加,必须转化成字符串
+ }
+
+ for (const key in timeSource) {
+ const [ret] = new RegExp(`${key}+`).exec(formatStr) || []
+ if (ret) {
+ // 年可能只需展示两位
+ const beginIndex = key === 'y' && ret.length === 2 ? 2 : 0
+ formatStr = formatStr.replace(ret, timeSource[key].slice(beginIndex))
+ }
+ }
+
+ return formatStr
+}
+
+/**
+ * @description 时间戳转为多久之前
+ * @param {String|Number} timestamp 时间戳
+ * @param {String|Boolean} format
+ * 格式化规则如果为时间格式字符串,超出一定时间范围,返回固定的时间格式;
+ * 如果为布尔值false,无论什么时间,都返回多久以前的格式
+ * @returns {string} 转化后的内容
+ */
+function timeFrom(timestamp = null, format = 'yyyy-mm-dd') {
+ if (timestamp == null) timestamp = Number(new Date())
+ timestamp = parseInt(timestamp)
+ // 判断用户输入的时间戳是秒还是毫秒,一般前端js获取的时间戳是毫秒(13位),后端传过来的为秒(10位)
+ if (timestamp.toString().length == 10) timestamp *= 1000
+ let timer = (new Date()).getTime() - timestamp
+ timer = parseInt(timer / 1000)
+ // 如果小于5分钟,则返回"刚刚",其他以此类推
+ let tips = ''
+ switch (true) {
+ case timer < 300:
+ tips = '刚刚'
+ break
+ case timer >= 300 && timer < 3600:
+ tips = `${parseInt(timer / 60)}分钟前`
+ break
+ case timer >= 3600 && timer < 86400:
+ tips = `${parseInt(timer / 3600)}小时前`
+ break
+ case timer >= 86400 && timer < 2592000:
+ tips = `${parseInt(timer / 86400)}天前`
+ break
+ default:
+ // 如果format为false,则无论什么时间戳,都显示xx之前
+ if (format === false) {
+ if (timer >= 2592000 && timer < 365 * 86400) {
+ tips = `${parseInt(timer / (86400 * 30))}个月前`
+ } else {
+ tips = `${parseInt(timer / (86400 * 365))}年前`
+ }
+ } else {
+ tips = timeFormat(timestamp, format)
+ }
+ }
+ return tips
+}
+
+/**
+ * @description 去除空格
+ * @param String str 需要去除空格的字符串
+ * @param String pos both(左右)|left|right|all 默认both
+ */
+function trim(str, pos = 'both') {
+ str = String(str)
+ if (pos == 'both') {
+ return str.replace(/^\s+|\s+$/g, '')
+ }
+ if (pos == 'left') {
+ return str.replace(/^\s*/, '')
+ }
+ if (pos == 'right') {
+ return str.replace(/(\s*$)/g, '')
+ }
+ if (pos == 'all') {
+ return str.replace(/\s+/g, '')
+ }
+ return str
+}
+
+/**
+ * @description 对象转url参数
+ * @param {object} data,对象
+ * @param {Boolean} isPrefix,是否自动加上"?"
+ * @param {string} arrayFormat 规则 indices|brackets|repeat|comma
+ */
+function queryParams(data = {}, isPrefix = true, arrayFormat = 'brackets') {
+ const prefix = isPrefix ? '?' : ''
+ const _result = []
+ if (['indices', 'brackets', 'repeat', 'comma'].indexOf(arrayFormat) == -1) arrayFormat = 'brackets'
+ for (const key in data) {
+ const value = data[key]
+ // 去掉为空的参数
+ if (['', undefined, null].indexOf(value) >= 0) {
+ continue
+ }
+ // 如果值为数组,另行处理
+ if (value.constructor === Array) {
+ // e.g. {ids: [1, 2, 3]}
+ switch (arrayFormat) {
+ case 'indices':
+ // 结果: ids[0]=1&ids[1]=2&ids[2]=3
+ for (let i = 0; i < value.length; i++) {
+ _result.push(`${key}[${i}]=${value[i]}`)
+ }
+ break
+ case 'brackets':
+ // 结果: ids[]=1&ids[]=2&ids[]=3
+ value.forEach((_value) => {
+ _result.push(`${key}[]=${_value}`)
+ })
+ break
+ case 'repeat':
+ // 结果: ids=1&ids=2&ids=3
+ value.forEach((_value) => {
+ _result.push(`${key}=${_value}`)
+ })
+ break
+ case 'comma':
+ // 结果: ids=1,2,3
+ let commaStr = ''
+ value.forEach((_value) => {
+ commaStr += (commaStr ? ',' : '') + _value
+ })
+ _result.push(`${key}=${commaStr}`)
+ break
+ default:
+ value.forEach((_value) => {
+ _result.push(`${key}[]=${_value}`)
+ })
+ }
+ } else {
+ _result.push(`${key}=${value}`)
+ }
+ }
+ return _result.length ? prefix + _result.join('&') : ''
+}
+
+/**
+ * 显示消息提示框
+ * @param {String} title 提示的内容,长度与 icon 取值有关。
+ * @param {Number} duration 提示的延迟时间,单位毫秒,默认:2000
+ */
+function toast(title, duration = 2000) {
+ uni.showToast({
+ title: String(title),
+ icon: 'none',
+ duration
+ })
+}
+
+/**
+ * @description 根据主题type值,获取对应的图标
+ * @param {String} type 主题名称,primary|info|error|warning|success
+ * @param {boolean} fill 是否使用fill填充实体的图标
+ */
+function type2icon(type = 'success', fill = false) {
+ // 如果非预置值,默认为success
+ if (['primary', 'info', 'error', 'warning', 'success'].indexOf(type) == -1) type = 'success'
+ let iconName = ''
+ // 目前(2019-12-12),info和primary使用同一个图标
+ switch (type) {
+ case 'primary':
+ iconName = 'info-circle'
+ break
+ case 'info':
+ iconName = 'info-circle'
+ break
+ case 'error':
+ iconName = 'close-circle'
+ break
+ case 'warning':
+ iconName = 'error-circle'
+ break
+ case 'success':
+ iconName = 'checkmark-circle'
+ break
+ default:
+ iconName = 'checkmark-circle'
+ }
+ // 是否是实体类型,加上-fill,在icon组件库中,实体的类名是后面加-fill的
+ if (fill) iconName += '-fill'
+ return iconName
+}
+
+/**
+ * @description 数字格式化
+ * @param {number|string} number 要格式化的数字
+ * @param {number} decimals 保留几位小数
+ * @param {string} decimalPoint 小数点符号
+ * @param {string} thousandsSeparator 千分位符号
+ * @returns {string} 格式化后的数字
+ */
+function priceFormat(number, decimals = 0, decimalPoint = '.', thousandsSeparator = ',') {
+ number = (`${number}`).replace(/[^0-9+-Ee.]/g, '')
+ const n = !isFinite(+number) ? 0 : +number
+ const prec = !isFinite(+decimals) ? 0 : Math.abs(decimals)
+ const sep = (typeof thousandsSeparator === 'undefined') ? ',' : thousandsSeparator
+ const dec = (typeof decimalPoint === 'undefined') ? '.' : decimalPoint
+ let s = ''
+
+ s = (prec ? round(n, prec) + '' : `${Math.round(n)}`).split('.')
+ const re = /(-?\d+)(\d{3})/
+ while (re.test(s[0])) {
+ s[0] = s[0].replace(re, `$1${sep}$2`)
+ }
+
+ if ((s[1] || '').length < prec) {
+ s[1] = s[1] || ''
+ s[1] += new Array(prec - s[1].length + 1).join('0')
+ }
+ return s.join(dec)
+}
+
+/**
+ * @description 获取duration值
+ * 如果带有ms或者s直接返回,如果大于一定值,认为是ms单位,小于一定值,认为是s单位
+ * 比如以30位阈值,那么300大于30,可以理解为用户想要的是300ms,而不是想花300s去执行一个动画
+ * @param {String|number} value 比如: "1s"|"100ms"|1|100
+ * @param {boolean} unit 提示: 如果是false 默认返回number
+ * @return {string|number}
+ */
+function getDuration(value, unit = true) {
+ const valueNum = parseInt(value)
+ if (unit) {
+ if (/s$/.test(value)) return value
+ return value > 30 ? `${value}ms` : `${value}s`
+ }
+ if (/ms$/.test(value)) return valueNum
+ if (/s$/.test(value)) return valueNum > 30 ? valueNum : valueNum * 1000
+ return valueNum
+}
+
+/**
+ * @description 日期的月或日补零操作
+ * @param {String} value 需要补零的值
+ */
+function padZero(value) {
+ return `00${value}`.slice(-2)
+}
+
+/**
+ * @description 在wu-form的子组件内容发生变化,或者失去焦点时,尝试通知wu-form执行校验方法
+ * @param {*} instance
+ * @param {*} event
+ */
+function formValidate(instance, event) {
+ const formItem = $parent.call(instance, 'wu-form-item')
+ const form = $parent.call(instance, 'wu-form')
+ // 如果发生变化的input或者textarea等,其父组件中有wu-form-item或者wu-form等,就执行form的validate方法
+ // 同时将form-item的pros传递给form,让其进行精确对象验证
+ if (formItem && form) {
+ form.validateField(formItem.prop, () => {}, event)
+ }
+}
+
+/**
+ * @description 获取某个对象下的属性,用于通过类似'a.b.c'的形式去获取一个对象的的属性的形式
+ * @param {object} obj 对象
+ * @param {string} key 需要获取的属性字段
+ * @returns {*}
+ */
+function getProperty(obj, key) {
+ if (!obj) {
+ return
+ }
+ if (typeof key !== 'string' || key === '') {
+ return ''
+ }
+ if (key.indexOf('.') !== -1) {
+ const keys = key.split('.')
+ let firstObj = obj[keys[0]] || {}
+
+ for (let i = 1; i < keys.length; i++) {
+ if (firstObj) {
+ firstObj = firstObj[keys[i]]
+ }
+ }
+ return firstObj
+ }
+ return obj[key]
+}
+
+/**
+ * @description 设置对象的属性值,如果'a.b.c'的形式进行设置
+ * @param {object} obj 对象
+ * @param {string} key 需要设置的属性
+ * @param {string} value 设置的值
+ */
+function setProperty(obj, key, value) {
+ if (!obj) {
+ return
+ }
+ // 递归赋值
+ const inFn = function(_obj, keys, v) {
+ // 最后一个属性key
+ if (keys.length === 1) {
+ _obj[keys[0]] = v
+ return
+ }
+ // 0~length-1个key
+ while (keys.length > 1) {
+ const k = keys[0]
+ if (!_obj[k] || (typeof _obj[k] !== 'object')) {
+ _obj[k] = {}
+ }
+ const key = keys.shift()
+ // 自调用判断是否存在属性,不存在则自动创建对象
+ inFn(_obj[k], keys, v)
+ }
+ }
+
+ if (typeof key !== 'string' || key === '') {
+
+ } else if (key.indexOf('.') !== -1) { // 支持多层级赋值操作
+ const keys = key.split('.')
+ inFn(obj, keys, value)
+ } else {
+ obj[key] = value
+ }
+}
+
+/**
+ * @description 获取当前页面路径
+ */
+function page() {
+ const pages = getCurrentPages();
+ const route = pages[pages.length - 1]?.route;
+ // 某些特殊情况下(比如页面进行redirectTo时的一些时机),pages可能为空数组
+ return `/${route ? route : ''}`
+}
+
+/**
+ * @description 获取当前路由栈实例数组
+ */
+function pages() {
+ const pages = getCurrentPages()
+ return pages
+}
+
+/**
+ * 获取页面历史栈指定层实例
+ * @param back {number} [0] - 0或者负数,表示获取历史栈的哪一层,0表示获取当前页面实例,-1 表示获取上一个页面实例。默认0。
+ */
+function getHistoryPage(back = 0) {
+ const pages = getCurrentPages()
+ const len = pages.length
+ return pages[len - 1 + back]
+}
+
+
+
+/**
+ * @description 修改wuui内置属性值
+ * @param {object} props 修改内置props属性
+ * @param {object} config 修改内置config属性
+ * @param {object} color 修改内置color属性
+ * @param {object} zIndex 修改内置zIndex属性
+ */
+function setConfig({
+ props = {},
+ config = {},
+ color = {},
+ zIndex = {}
+}) {
+ const {
+ deepMerge,
+ } = uni.$w
+ uni.$w.config = deepMerge(uni.$w.config, config)
+ uni.$w.props = deepMerge(uni.$w.props, props)
+ uni.$w.color = deepMerge(uni.$w.color, color)
+ uni.$w.zIndex = deepMerge(uni.$w.zIndex, zIndex)
+}
+
+export {
+ range,
+ getPx,
+ sleep,
+ os,
+ sys,
+ random,
+ guid,
+ $parent,
+ addStyle,
+ addUnit,
+ deepClone,
+ deepMerge,
+ error,
+ randomArray,
+ timeFormat,
+ timeFrom,
+ trim,
+ queryParams,
+ toast,
+ type2icon,
+ priceFormat,
+ getDuration,
+ padZero,
+ formValidate,
+ getProperty,
+ setProperty,
+ page,
+ pages,
+ getHistoryPage,
+ setConfig,
+ Color
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/function/platform.js b/uni_modules/wu-ui-tools/libs/function/platform.js
new file mode 100644
index 0000000..d6b926e
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/platform.js
@@ -0,0 +1,75 @@
+/**
+ * 注意:
+ * 此部分内容,在vue-cli模式下,需要在vue.config.js加入如下内容才有效:
+ * module.exports = {
+ * transpileDependencies: ['uview-v2']
+ * }
+ */
+
+let platform = 'none'
+
+// #ifdef VUE3
+platform = 'vue3'
+// #endif
+
+// #ifdef VUE2
+platform = 'vue2'
+// #endif
+
+// #ifdef APP-PLUS
+platform = 'plus'
+// #endif
+
+// #ifdef APP-NVUE
+platform = 'nvue'
+// #endif
+
+// #ifdef H5
+platform = 'h5'
+// #endif
+
+// #ifdef MP-WEIXIN
+platform = 'weixin'
+// #endif
+
+// #ifdef MP-ALIPAY
+platform = 'alipay'
+// #endif
+
+// #ifdef MP-BAIDU
+platform = 'baidu'
+// #endif
+
+// #ifdef MP-TOUTIAO
+platform = 'toutiao'
+// #endif
+
+// #ifdef MP-QQ
+platform = 'qq'
+// #endif
+
+// #ifdef MP-KUAISHOU
+platform = 'kuaishou'
+// #endif
+
+// #ifdef MP-360
+platform = '360'
+// #endif
+
+// #ifdef MP
+platform = 'mp'
+// #endif
+
+// #ifdef QUICKAPP-WEBVIEW
+platform = 'quickapp-webview'
+// #endif
+
+// #ifdef QUICKAPP-WEBVIEW-HUAWEI
+platform = 'quickapp-webview-huawei'
+// #endif
+
+// #ifdef QUICKAPP-WEBVIEW-UNION
+platform = 'quckapp-webview-union'
+// #endif
+
+export default platform
diff --git a/uni_modules/wu-ui-tools/libs/function/test.js b/uni_modules/wu-ui-tools/libs/function/test.js
new file mode 100644
index 0000000..7c8b747
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/test.js
@@ -0,0 +1,287 @@
+/**
+ * 验证电子邮箱格式
+ */
+function email(value) {
+ return /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(value)
+}
+
+/**
+ * 验证手机格式
+ */
+function mobile(value) {
+ return /^1([3589]\d|4[5-9]|6[1-2,4-7]|7[0-8])\d{8}$/.test(value)
+}
+
+/**
+ * 验证URL格式
+ */
+function url(value) {
+ return /^((https|http|ftp|rtsp|mms):\/\/)(([0-9a-zA-Z_!~*'().&=+$%-]+: )?[0-9a-zA-Z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z].[a-zA-Z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9a-zA-Z_!~*'().;?:@&=+$,%#-]+)+\/?)$/
+ .test(value)
+}
+
+/**
+ * 验证日期格式
+ */
+function date(value) {
+ if (!value) return false
+ // 判断是否数值或者字符串数值(意味着为时间戳),转为数值,否则new Date无法识别字符串时间戳
+ if (number(value)) value = +value
+ return !/Invalid|NaN/.test(new Date(value).toString())
+}
+
+/**
+ * 验证ISO类型的日期格式
+ */
+function dateISO(value) {
+ return /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value)
+}
+
+/**
+ * 验证十进制数字
+ */
+function number(value) {
+ return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value)
+}
+
+/**
+ * 验证字符串
+ */
+function string(value) {
+ return typeof value === 'string'
+}
+
+/**
+ * 验证整数
+ */
+function digits(value) {
+ return /^\d+$/.test(value)
+}
+
+/**
+ * 验证身份证号码
+ */
+function idCard(value) {
+ return /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(
+ value
+ )
+}
+
+/**
+ * 是否车牌号
+ */
+function carNo(value) {
+ // 新能源车牌
+ const xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/
+ // 旧车牌
+ const creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/
+ if (value.length === 7) {
+ return creg.test(value)
+ } if (value.length === 8) {
+ return xreg.test(value)
+ }
+ return false
+}
+
+/**
+ * 金额,只允许2位小数
+ */
+function amount(value) {
+ // 金额,只允许保留两位小数
+ return /^[1-9]\d*(,\d{3})*(\.\d{1,2})?$|^0\.\d{1,2}$/.test(value)
+}
+
+/**
+ * 中文
+ */
+function chinese(value) {
+ const reg = /^[\u4e00-\u9fa5]+$/gi
+ return reg.test(value)
+}
+
+/**
+ * 只能输入字母
+ */
+function letter(value) {
+ return /^[a-zA-Z]*$/.test(value)
+}
+
+/**
+ * 只能是字母或者数字
+ */
+function enOrNum(value) {
+ // 英文或者数字
+ const reg = /^[0-9a-zA-Z]*$/g
+ return reg.test(value)
+}
+
+/**
+ * 验证是否包含某个值
+ */
+function contains(value, param) {
+ return value.indexOf(param) >= 0
+}
+
+/**
+ * 验证一个值范围[min, max]
+ */
+function range(value, param) {
+ return value >= param[0] && value <= param[1]
+}
+
+/**
+ * 验证一个长度范围[min, max]
+ */
+function rangeLength(value, param) {
+ return value.length >= param[0] && value.length <= param[1]
+}
+
+/**
+ * 是否固定电话
+ */
+function landline(value) {
+ const reg = /^\d{3,4}-\d{7,8}(-\d{3,4})?$/
+ return reg.test(value)
+}
+
+/**
+ * 判断是否为空
+ */
+function empty(value) {
+ switch (typeof value) {
+ case 'undefined':
+ return true
+ case 'string':
+ if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true
+ break
+ case 'boolean':
+ if (!value) return true
+ break
+ case 'number':
+ if (value === 0 || isNaN(value)) return true
+ break
+ case 'object':
+ if (value === null || value.length === 0) return true
+ for (const i in value) {
+ return false
+ }
+ return true
+ }
+ return false
+}
+
+/**
+ * 是否json字符串
+ */
+function jsonString(value) {
+ if (typeof value === 'string') {
+ try {
+ const obj = JSON.parse(value)
+ if (typeof obj === 'object' && obj) {
+ return true
+ }
+ return false
+ } catch (e) {
+ return false
+ }
+ }
+ return false
+}
+
+/**
+ * 是否数组
+ */
+function array(value) {
+ if (typeof Array.isArray === 'function') {
+ return Array.isArray(value)
+ }
+ return Object.prototype.toString.call(value) === '[object Array]'
+}
+
+/**
+ * 是否对象
+ */
+function object(value) {
+ return Object.prototype.toString.call(value) === '[object Object]'
+}
+
+/**
+ * 是否短信验证码
+ */
+function code(value, len = 6) {
+ return new RegExp(`^\\d{${len}}$`).test(value)
+}
+
+/**
+ * 是否函数方法
+ * @param {Object} value
+ */
+function func(value) {
+ return typeof value === 'function'
+}
+
+/**
+ * 是否promise对象
+ * @param {Object} value
+ */
+function promise(value) {
+ return object(value) && func(value.then) && func(value.catch)
+}
+
+/** 是否图片格式
+ * @param {Object} value
+ */
+function image(value) {
+ const newValue = value.split('?')[0]
+ const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i
+ return IMAGE_REGEXP.test(newValue)
+}
+
+/**
+ * 是否视频格式
+ * @param {Object} value
+ */
+function video(value) {
+ const VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv|m3u8)/i
+ return VIDEO_REGEXP.test(value)
+}
+
+/**
+ * 是否为正则对象
+ * @param {Object}
+ * @return {Boolean}
+ */
+function regExp(o) {
+ return o && Object.prototype.toString.call(o) === '[object RegExp]'
+}
+
+export {
+ email,
+ mobile,
+ url,
+ date,
+ dateISO,
+ number,
+ digits,
+ idCard,
+ carNo,
+ amount,
+ chinese,
+ letter,
+ enOrNum,
+ contains,
+ range,
+ rangeLength,
+ empty,
+ jsonString,
+ landline,
+ object,
+ array,
+ code,
+ func,
+ promise,
+ video,
+ image,
+ regExp,
+ string
+}
diff --git a/uni_modules/wu-ui-tools/libs/function/throttle.js b/uni_modules/wu-ui-tools/libs/function/throttle.js
new file mode 100644
index 0000000..2f33611
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/function/throttle.js
@@ -0,0 +1,30 @@
+let timer; let
+ flag
+/**
+ * 节流原理:在一定时间内,只能触发一次
+ *
+ * @param {Function} func 要执行的回调函数
+ * @param {Number} wait 延时的时间
+ * @param {Boolean} immediate 是否立即执行
+ * @return null
+ */
+function throttle(func, wait = 500, immediate = true) {
+ if (immediate) {
+ if (!flag) {
+ flag = true
+ // 如果是立即执行,则在wait毫秒内开始时执行
+ typeof func === 'function' && func()
+ timer = setTimeout(() => {
+ flag = false
+ }, wait)
+ }
+ } else if (!flag) {
+ flag = true
+ // 如果是非立即执行,则在wait毫秒内的结束处执行
+ timer = setTimeout(() => {
+ flag = false
+ typeof func === 'function' && func()
+ }, wait)
+ }
+}
+export default throttle
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/adapters/index.js b/uni_modules/wu-ui-tools/libs/luch-request/adapters/index.js
new file mode 100644
index 0000000..e03cf5f
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/adapters/index.js
@@ -0,0 +1,97 @@
+import buildURL from '../helpers/buildURL'
+import buildFullPath from '../core/buildFullPath'
+import settle from '../core/settle'
+import { isUndefined } from '../utils'
+
+/**
+ * 返回可选值存在的配置
+ * @param {Array} keys - 可选值数组
+ * @param {Object} config2 - 配置
+ * @return {{}} - 存在的配置项
+ */
+const mergeKeys = (keys, config2) => {
+ const config = {}
+ keys.forEach((prop) => {
+ if (!isUndefined(config2[prop])) {
+ config[prop] = config2[prop]
+ }
+ })
+ return config
+}
+export default (config) => new Promise((resolve, reject) => {
+ const fullPath = buildURL(buildFullPath(config.baseURL, config.url), config.params)
+ const _config = {
+ url: fullPath,
+ header: config.header,
+ complete: (response) => {
+ config.fullPath = fullPath
+ response.config = config
+ try {
+ // 对可能字符串不是json 的情况容错
+ if (typeof response.data === 'string') {
+ response.data = JSON.parse(response.data)
+ }
+ // eslint-disable-next-line no-empty
+ } catch (e) {
+ }
+ settle(resolve, reject, response)
+ }
+ }
+ let requestTask
+ if (config.method === 'UPLOAD') {
+ delete _config.header['content-type']
+ delete _config.header['Content-Type']
+ const otherConfig = {
+ // #ifdef MP-ALIPAY
+ fileType: config.fileType,
+ // #endif
+ filePath: config.filePath,
+ name: config.name
+ }
+ const optionalKeys = [
+ // #ifdef APP-PLUS || H5
+ 'files',
+ // #endif
+ // #ifdef H5
+ 'file',
+ // #endif
+ // #ifdef H5 || APP-PLUS
+ 'timeout',
+ // #endif
+ 'formData'
+ ]
+ requestTask = uni.uploadFile({ ..._config, ...otherConfig, ...mergeKeys(optionalKeys, config) })
+ } else if (config.method === 'DOWNLOAD') {
+ // #ifdef H5 || APP-PLUS
+ if (!isUndefined(config.timeout)) {
+ _config.timeout = config.timeout
+ }
+ // #endif
+ requestTask = uni.downloadFile(_config)
+ } else {
+ const optionalKeys = [
+ 'data',
+ 'method',
+ // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
+ 'timeout',
+ // #endif
+ 'dataType',
+ // #ifndef MP-ALIPAY
+ 'responseType',
+ // #endif
+ // #ifdef APP-PLUS
+ 'sslVerify',
+ // #endif
+ // #ifdef H5
+ 'withCredentials',
+ // #endif
+ // #ifdef APP-PLUS
+ 'firstIpv4'
+ // #endif
+ ]
+ requestTask = uni.request({ ..._config, ...mergeKeys(optionalKeys, config) })
+ }
+ if (config.getTask) {
+ config.getTask(requestTask, config)
+ }
+})
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/InterceptorManager.js b/uni_modules/wu-ui-tools/libs/luch-request/core/InterceptorManager.js
new file mode 100644
index 0000000..3e8728d
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/InterceptorManager.js
@@ -0,0 +1,50 @@
+'use strict'
+
+function InterceptorManager() {
+ this.handlers = []
+}
+
+/**
+ * Add a new interceptor to the stack
+ *
+ * @param {Function} fulfilled The function to handle `then` for a `Promise`
+ * @param {Function} rejected The function to handle `reject` for a `Promise`
+ *
+ * @return {Number} An ID used to remove interceptor later
+ */
+InterceptorManager.prototype.use = function use(fulfilled, rejected) {
+ this.handlers.push({
+ fulfilled,
+ rejected
+ })
+ return this.handlers.length - 1
+}
+
+/**
+ * Remove an interceptor from the stack
+ *
+ * @param {Number} id The ID that was returned by `use`
+ */
+InterceptorManager.prototype.eject = function eject(id) {
+ if (this.handlers[id]) {
+ this.handlers[id] = null
+ }
+}
+
+/**
+ * Iterate over all the registered interceptors
+ *
+ * This method is particularly useful for skipping over any
+ * interceptors that may have become `null` calling `eject`.
+ *
+ * @param {Function} fn The function to call for each interceptor
+ */
+InterceptorManager.prototype.forEach = function forEach(fn) {
+ this.handlers.forEach((h) => {
+ if (h !== null) {
+ fn(h)
+ }
+ })
+}
+
+export default InterceptorManager
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/Request.js b/uni_modules/wu-ui-tools/libs/luch-request/core/Request.js
new file mode 100644
index 0000000..cc48566
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/Request.js
@@ -0,0 +1,198 @@
+/**
+ * @Class Request
+ * @description luch-request http请求插件
+ * @version 3.0.7
+ * @Author lu-ch
+ * @Date 2021-09-04
+ * @Email webwork.s@qq.com
+ * 文档: https://www.quanzhan.co/luch-request/
+ * github: https://github.com/lei-mu/luch-request
+ * DCloud: http://ext.dcloud.net.cn/plugin?id=392
+ * HBuilderX: beat-3.0.4 alpha-3.0.4
+ */
+
+import dispatchRequest from './dispatchRequest'
+import InterceptorManager from './InterceptorManager'
+import mergeConfig from './mergeConfig'
+import defaults from './defaults'
+import { isPlainObject } from '../utils'
+import clone from '../utils/clone'
+
+export default class Request {
+ /**
+ * @param {Object} arg - 全局配置
+ * @param {String} arg.baseURL - 全局根路径
+ * @param {Object} arg.header - 全局header
+ * @param {String} arg.method = [GET|POST|PUT|DELETE|CONNECT|HEAD|OPTIONS|TRACE] - 全局默认请求方式
+ * @param {String} arg.dataType = [json] - 全局默认的dataType
+ * @param {String} arg.responseType = [text|arraybuffer] - 全局默认的responseType。支付宝小程序不支持
+ * @param {Object} arg.custom - 全局默认的自定义参数
+ * @param {Number} arg.timeout - 全局默认的超时时间,单位 ms。默认60000。H5(HBuilderX 2.9.9+)、APP(HBuilderX 2.9.9+)、微信小程序(2.10.0)、支付宝小程序
+ * @param {Boolean} arg.sslVerify - 全局默认的是否验证 ssl 证书。默认true.仅App安卓端支持(HBuilderX 2.3.3+)
+ * @param {Boolean} arg.withCredentials - 全局默认的跨域请求时是否携带凭证(cookies)。默认false。仅H5支持(HBuilderX 2.6.15+)
+ * @param {Boolean} arg.firstIpv4 - 全DNS解析时优先使用ipv4。默认false。仅 App-Android 支持 (HBuilderX 2.8.0+)
+ * @param {Function(statusCode):Boolean} arg.validateStatus - 全局默认的自定义验证器。默认statusCode >= 200 && statusCode < 300
+ */
+ constructor(arg = {}) {
+ if (!isPlainObject(arg)) {
+ arg = {}
+ console.warn('设置全局参数必须接收一个Object')
+ }
+ this.config = clone({ ...defaults, ...arg })
+ this.interceptors = {
+ request: new InterceptorManager(),
+ response: new InterceptorManager()
+ }
+ }
+
+ /**
+ * @Function
+ * @param {Request~setConfigCallback} f - 设置全局默认配置
+ */
+ setConfig(f) {
+ this.config = f(this.config)
+ }
+
+ middleware(config) {
+ config = mergeConfig(this.config, config)
+ const chain = [dispatchRequest, undefined]
+ let promise = Promise.resolve(config)
+
+ this.interceptors.request.forEach((interceptor) => {
+ chain.unshift(interceptor.fulfilled, interceptor.rejected)
+ })
+
+ this.interceptors.response.forEach((interceptor) => {
+ chain.push(interceptor.fulfilled, interceptor.rejected)
+ })
+
+ while (chain.length) {
+ promise = promise.then(chain.shift(), chain.shift())
+ }
+
+ return promise
+ }
+
+ /**
+ * @Function
+ * @param {Object} config - 请求配置项
+ * @prop {String} options.url - 请求路径
+ * @prop {Object} options.data - 请求参数
+ * @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
+ * @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
+ * @prop {Object} [options.header = config.header] - 请求header
+ * @prop {Object} [options.method = config.method] - 请求方法
+ * @returns {Promise}
+ */
+ request(config = {}) {
+ return this.middleware(config)
+ }
+
+ get(url, options = {}) {
+ return this.middleware({
+ url,
+ method: 'GET',
+ ...options
+ })
+ }
+
+ post(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'POST',
+ ...options
+ })
+ }
+
+ // #ifndef MP-ALIPAY
+ put(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'PUT',
+ ...options
+ })
+ }
+
+ // #endif
+
+ // #ifdef APP-PLUS || H5 || MP-WEIXIN || MP-BAIDU
+ delete(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'DELETE',
+ ...options
+ })
+ }
+
+ // #endif
+
+ // #ifdef H5 || MP-WEIXIN
+ connect(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'CONNECT',
+ ...options
+ })
+ }
+
+ // #endif
+
+ // #ifdef H5 || MP-WEIXIN || MP-BAIDU
+ head(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'HEAD',
+ ...options
+ })
+ }
+
+ // #endif
+
+ // #ifdef APP-PLUS || H5 || MP-WEIXIN || MP-BAIDU
+ options(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'OPTIONS',
+ ...options
+ })
+ }
+
+ // #endif
+
+ // #ifdef H5 || MP-WEIXIN
+ trace(url, data, options = {}) {
+ return this.middleware({
+ url,
+ data,
+ method: 'TRACE',
+ ...options
+ })
+ }
+
+ // #endif
+
+ upload(url, config = {}) {
+ config.url = url
+ config.method = 'UPLOAD'
+ return this.middleware(config)
+ }
+
+ download(url, config = {}) {
+ config.url = url
+ config.method = 'DOWNLOAD'
+ return this.middleware(config)
+ }
+}
+
+/**
+ * setConfig回调
+ * @return {Object} - 返回操作后的config
+ * @callback Request~setConfigCallback
+ * @param {Object} config - 全局默认config
+ */
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/buildFullPath.js b/uni_modules/wu-ui-tools/libs/luch-request/core/buildFullPath.js
new file mode 100644
index 0000000..5eb8a17
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/buildFullPath.js
@@ -0,0 +1,20 @@
+'use strict'
+
+import isAbsoluteURL from '../helpers/isAbsoluteURL'
+import combineURLs from '../helpers/combineURLs'
+
+/**
+ * Creates a new URL by combining the baseURL with the requestedURL,
+ * only when the requestedURL is not already an absolute URL.
+ * If the requestURL is absolute, this function returns the requestedURL untouched.
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} requestedURL Absolute or relative URL to combine
+ * @returns {string} The combined full path
+ */
+export default function buildFullPath(baseURL, requestedURL) {
+ if (baseURL && !isAbsoluteURL(requestedURL)) {
+ return combineURLs(baseURL, requestedURL)
+ }
+ return requestedURL
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/defaults.js b/uni_modules/wu-ui-tools/libs/luch-request/core/defaults.js
new file mode 100644
index 0000000..be375a9
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/defaults.js
@@ -0,0 +1,29 @@
+/**
+ * 默认的全局配置
+ */
+
+export default {
+ baseURL: '',
+ header: {},
+ method: 'GET',
+ dataType: 'json',
+ // #ifndef MP-ALIPAY
+ responseType: 'text',
+ // #endif
+ custom: {},
+ // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
+ timeout: 60000,
+ // #endif
+ // #ifdef APP-PLUS
+ sslVerify: true,
+ // #endif
+ // #ifdef H5
+ withCredentials: false,
+ // #endif
+ // #ifdef APP-PLUS
+ firstIpv4: false,
+ // #endif
+ validateStatus: function validateStatus(status) {
+ return status >= 200 && status < 300
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/dispatchRequest.js b/uni_modules/wu-ui-tools/libs/luch-request/core/dispatchRequest.js
new file mode 100644
index 0000000..724545c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/dispatchRequest.js
@@ -0,0 +1,3 @@
+import adapter from '../adapters/index'
+
+export default (config) => adapter(config)
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/mergeConfig.js b/uni_modules/wu-ui-tools/libs/luch-request/core/mergeConfig.js
new file mode 100644
index 0000000..08f8b9b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/mergeConfig.js
@@ -0,0 +1,103 @@
+import { deepMerge, isUndefined } from '../utils'
+
+/**
+ * 合并局部配置优先的配置,如果局部有该配置项则用局部,如果全局有该配置项则用全局
+ * @param {Array} keys - 配置项
+ * @param {Object} globalsConfig - 当前的全局配置
+ * @param {Object} config2 - 局部配置
+ * @return {{}}
+ */
+const mergeKeys = (keys, globalsConfig, config2) => {
+ const config = {}
+ keys.forEach((prop) => {
+ if (!isUndefined(config2[prop])) {
+ config[prop] = config2[prop]
+ } else if (!isUndefined(globalsConfig[prop])) {
+ config[prop] = globalsConfig[prop]
+ }
+ })
+ return config
+}
+/**
+ *
+ * @param globalsConfig - 当前实例的全局配置
+ * @param config2 - 当前的局部配置
+ * @return - 合并后的配置
+ */
+export default (globalsConfig, config2 = {}) => {
+ const method = config2.method || globalsConfig.method || 'GET'
+ let config = {
+ baseURL: globalsConfig.baseURL || '',
+ method,
+ url: config2.url || '',
+ params: config2.params || {},
+ custom: { ...(globalsConfig.custom || {}), ...(config2.custom || {}) },
+ header: deepMerge(globalsConfig.header || {}, config2.header || {})
+ }
+ const defaultToConfig2Keys = ['getTask', 'validateStatus']
+ config = { ...config, ...mergeKeys(defaultToConfig2Keys, globalsConfig, config2) }
+
+ // eslint-disable-next-line no-empty
+ if (method === 'DOWNLOAD') {
+ // #ifdef H5 || APP-PLUS
+ if (!isUndefined(config2.timeout)) {
+ config.timeout = config2.timeout
+ } else if (!isUndefined(globalsConfig.timeout)) {
+ config.timeout = globalsConfig.timeout
+ }
+ // #endif
+ } else if (method === 'UPLOAD') {
+ delete config.header['content-type']
+ delete config.header['Content-Type']
+ const uploadKeys = [
+ // #ifdef APP-PLUS || H5
+ 'files',
+ // #endif
+ // #ifdef MP-ALIPAY
+ 'fileType',
+ // #endif
+ // #ifdef H5
+ 'file',
+ // #endif
+ 'filePath',
+ 'name',
+ // #ifdef H5 || APP-PLUS
+ 'timeout',
+ // #endif
+ 'formData'
+ ]
+ uploadKeys.forEach((prop) => {
+ if (!isUndefined(config2[prop])) {
+ config[prop] = config2[prop]
+ }
+ })
+ // #ifdef H5 || APP-PLUS
+ if (isUndefined(config.timeout) && !isUndefined(globalsConfig.timeout)) {
+ config.timeout = globalsConfig.timeout
+ }
+ // #endif
+ } else {
+ const defaultsKeys = [
+ 'data',
+ // #ifdef H5 || APP-PLUS || MP-ALIPAY || MP-WEIXIN
+ 'timeout',
+ // #endif
+ 'dataType',
+ // #ifndef MP-ALIPAY
+ 'responseType',
+ // #endif
+ // #ifdef APP-PLUS
+ 'sslVerify',
+ // #endif
+ // #ifdef H5
+ 'withCredentials',
+ // #endif
+ // #ifdef APP-PLUS
+ 'firstIpv4'
+ // #endif
+ ]
+ config = { ...config, ...mergeKeys(defaultsKeys, globalsConfig, config2) }
+ }
+
+ return config
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/core/settle.js b/uni_modules/wu-ui-tools/libs/luch-request/core/settle.js
new file mode 100644
index 0000000..8d3638f
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/core/settle.js
@@ -0,0 +1,16 @@
+/**
+ * Resolve or reject a Promise based on response status.
+ *
+ * @param {Function} resolve A function that resolves the promise.
+ * @param {Function} reject A function that rejects the promise.
+ * @param {object} response The response.
+ */
+export default function settle(resolve, reject, response) {
+ const { validateStatus } = response.config
+ const status = response.statusCode
+ if (status && (!validateStatus || validateStatus(status))) {
+ resolve(response)
+ } else {
+ reject(response)
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/helpers/buildURL.js b/uni_modules/wu-ui-tools/libs/luch-request/helpers/buildURL.js
new file mode 100644
index 0000000..472ad6a
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/helpers/buildURL.js
@@ -0,0 +1,69 @@
+'use strict'
+
+import * as utils from '../utils'
+
+function encode(val) {
+ return encodeURIComponent(val)
+ .replace(/%40/gi, '@')
+ .replace(/%3A/gi, ':')
+ .replace(/%24/g, '$')
+ .replace(/%2C/gi, ',')
+ .replace(/%20/g, '+')
+ .replace(/%5B/gi, '[')
+ .replace(/%5D/gi, ']')
+}
+
+/**
+ * Build a URL by appending params to the end
+ *
+ * @param {string} url The base of the url (e.g., http://www.google.com)
+ * @param {object} [params] The params to be appended
+ * @returns {string} The formatted url
+ */
+export default function buildURL(url, params) {
+ /* eslint no-param-reassign:0 */
+ if (!params) {
+ return url
+ }
+
+ let serializedParams
+ if (utils.isURLSearchParams(params)) {
+ serializedParams = params.toString()
+ } else {
+ const parts = []
+
+ utils.forEach(params, (val, key) => {
+ if (val === null || typeof val === 'undefined') {
+ return
+ }
+
+ if (utils.isArray(val)) {
+ key = `${key}[]`
+ } else {
+ val = [val]
+ }
+
+ utils.forEach(val, (v) => {
+ if (utils.isDate(v)) {
+ v = v.toISOString()
+ } else if (utils.isObject(v)) {
+ v = JSON.stringify(v)
+ }
+ parts.push(`${encode(key)}=${encode(v)}`)
+ })
+ })
+
+ serializedParams = parts.join('&')
+ }
+
+ if (serializedParams) {
+ const hashmarkIndex = url.indexOf('#')
+ if (hashmarkIndex !== -1) {
+ url = url.slice(0, hashmarkIndex)
+ }
+
+ url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams
+ }
+
+ return url
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/helpers/combineURLs.js b/uni_modules/wu-ui-tools/libs/luch-request/helpers/combineURLs.js
new file mode 100644
index 0000000..ac7c124
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/helpers/combineURLs.js
@@ -0,0 +1,14 @@
+'use strict'
+
+/**
+ * Creates a new URL by combining the specified URLs
+ *
+ * @param {string} baseURL The base URL
+ * @param {string} relativeURL The relative URL
+ * @returns {string} The combined URL
+ */
+export default function combineURLs(baseURL, relativeURL) {
+ return relativeURL
+ ? `${baseURL.replace(/\/+$/, '')}/${relativeURL.replace(/^\/+/, '')}`
+ : baseURL
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/helpers/isAbsoluteURL.js b/uni_modules/wu-ui-tools/libs/luch-request/helpers/isAbsoluteURL.js
new file mode 100644
index 0000000..63c6647
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/helpers/isAbsoluteURL.js
@@ -0,0 +1,14 @@
+'use strict'
+
+/**
+ * Determines whether the specified URL is absolute
+ *
+ * @param {string} url The URL to test
+ * @returns {boolean} True if the specified URL is absolute, otherwise false
+ */
+export default function isAbsoluteURL(url) {
+ // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).
+ // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
+ // by any combination of letters, digits, plus, period, or hyphen.
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url)
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/index.d.ts b/uni_modules/wu-ui-tools/libs/luch-request/index.d.ts
new file mode 100644
index 0000000..e939ce1
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/index.d.ts
@@ -0,0 +1,116 @@
+type AnyObject = Record
+type HttpPromise = Promise>;
+type Tasks = UniApp.RequestTask | UniApp.UploadTask | UniApp.DownloadTask
+export interface RequestTask {
+ abort: () => void;
+ offHeadersReceived: () => void;
+ onHeadersReceived: () => void;
+}
+export interface HttpRequestConfig {
+ /** 请求基地址 */
+ baseURL?: string;
+ /** 请求服务器接口地址 */
+ url?: string;
+
+ /** 请求查询参数,自动拼接为查询字符串 */
+ params?: AnyObject;
+ /** 请求体参数 */
+ data?: AnyObject;
+
+ /** 文件对应的 key */
+ name?: string;
+ /** HTTP 请求中其他额外的 form data */
+ formData?: AnyObject;
+ /** 要上传文件资源的路径。 */
+ filePath?: string;
+ /** 需要上传的文件列表。使用 files 时,filePath 和 name 不生效,App、H5( 2.6.15+) */
+ files?: Array<{
+ name?: string;
+ file?: File;
+ uri: string;
+ }>;
+ /** 要上传的文件对象,仅H5(2.6.15+)支持 */
+ file?: File;
+
+ /** 请求头信息 */
+ header?: AnyObject;
+ /** 请求方式 */
+ method?: "GET" | "POST" | "PUT" | "DELETE" | "CONNECT" | "HEAD" | "OPTIONS" | "TRACE" | "UPLOAD" | "DOWNLOAD";
+ /** 如果设为 json,会尝试对返回的数据做一次 JSON.parse */
+ dataType?: string;
+ /** 设置响应的数据类型,支付宝小程序不支持 */
+ responseType?: "text" | "arraybuffer";
+ /** 自定义参数 */
+ custom?: AnyObject;
+ /** 超时时间,仅微信小程序(2.10.0)、支付宝小程序支持 */
+ timeout?: number;
+ /** DNS解析时优先使用ipv4,仅 App-Android 支持 (HBuilderX 2.8.0+) */
+ firstIpv4?: boolean;
+ /** 验证 ssl 证书 仅5+App安卓端支持(HBuilderX 2.3.3+) */
+ sslVerify?: boolean;
+ /** 跨域请求时是否携带凭证(cookies)仅H5支持(HBuilderX 2.6.15+) */
+ withCredentials?: boolean;
+
+ /** 返回当前请求的task, options。请勿在此处修改options。 */
+ getTask?: (task: T, options: HttpRequestConfig) => void;
+ /** 全局自定义验证器 */
+ validateStatus?: (statusCode: number) => boolean | void;
+}
+export interface HttpResponse {
+ config: HttpRequestConfig;
+ statusCode: number;
+ cookies: Array;
+ data: T;
+ errMsg: string;
+ header: AnyObject;
+}
+export interface HttpUploadResponse {
+ config: HttpRequestConfig;
+ statusCode: number;
+ data: T;
+ errMsg: string;
+}
+export interface HttpDownloadResponse extends HttpResponse {
+ tempFilePath: string;
+}
+export interface HttpError {
+ config: HttpRequestConfig;
+ statusCode?: number;
+ cookies?: Array;
+ data?: any;
+ errMsg: string;
+ header?: AnyObject;
+}
+export interface HttpInterceptorManager {
+ use(
+ onFulfilled?: (config: V) => Promise | V,
+ onRejected?: (config: E) => Promise | E
+ ): void;
+ eject(id: number): void;
+}
+export abstract class HttpRequestAbstract {
+ constructor(config?: HttpRequestConfig);
+ config: HttpRequestConfig;
+ interceptors: {
+ request: HttpInterceptorManager;
+ response: HttpInterceptorManager;
+ }
+ middleware(config: HttpRequestConfig): HttpPromise;
+ request(config: HttpRequestConfig): HttpPromise;
+ get(url: string, config?: HttpRequestConfig): HttpPromise;
+ upload(url: string, config?: HttpRequestConfig): HttpPromise;
+ delete(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ head(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ post(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ put(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ connect(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ options(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+ trace(url: string, data?: AnyObject, config?: HttpRequestConfig): HttpPromise;
+
+ download(url: string, config?: HttpRequestConfig): Promise;
+
+ setConfig(onSend: (config: HttpRequestConfig) => HttpRequestConfig): void;
+}
+
+declare class HttpRequest extends HttpRequestAbstract { }
+export default HttpRequest;
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/index.js b/uni_modules/wu-ui-tools/libs/luch-request/index.js
new file mode 100644
index 0000000..8fb2b44
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/index.js
@@ -0,0 +1,3 @@
+import Request from './core/Request'
+
+export default Request
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/utils.js b/uni_modules/wu-ui-tools/libs/luch-request/utils.js
new file mode 100644
index 0000000..847283d
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/utils.js
@@ -0,0 +1,131 @@
+'use strict'
+
+// utils is a library of generic helper functions non-specific to axios
+
+const { toString } = Object.prototype
+
+/**
+ * Determine if a value is an Array
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Array, otherwise false
+ */
+export function isArray(val) {
+ return toString.call(val) === '[object Array]'
+}
+
+/**
+ * Determine if a value is an Object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is an Object, otherwise false
+ */
+export function isObject(val) {
+ return val !== null && typeof val === 'object'
+}
+
+/**
+ * Determine if a value is a Date
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a Date, otherwise false
+ */
+export function isDate(val) {
+ return toString.call(val) === '[object Date]'
+}
+
+/**
+ * Determine if a value is a URLSearchParams object
+ *
+ * @param {Object} val The value to test
+ * @returns {boolean} True if value is a URLSearchParams object, otherwise false
+ */
+export function isURLSearchParams(val) {
+ return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams
+}
+
+/**
+ * Iterate over an Array or an Object invoking a function for each item.
+ *
+ * If `obj` is an Array callback will be called passing
+ * the value, index, and complete array for each item.
+ *
+ * If 'obj' is an Object callback will be called passing
+ * the value, key, and complete object for each property.
+ *
+ * @param {Object|Array} obj The object to iterate
+ * @param {Function} fn The callback to invoke for each item
+ */
+export function forEach(obj, fn) {
+ // Don't bother if no value provided
+ if (obj === null || typeof obj === 'undefined') {
+ return
+ }
+
+ // Force an array if not already something iterable
+ if (typeof obj !== 'object') {
+ /* eslint no-param-reassign:0 */
+ obj = [obj]
+ }
+
+ if (isArray(obj)) {
+ // Iterate over array values
+ for (let i = 0, l = obj.length; i < l; i++) {
+ fn.call(null, obj[i], i, obj)
+ }
+ } else {
+ // Iterate over object keys
+ for (const key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ fn.call(null, obj[key], key, obj)
+ }
+ }
+ }
+}
+
+/**
+ * 是否为boolean 值
+ * @param val
+ * @returns {boolean}
+ */
+export function isBoolean(val) {
+ return typeof val === 'boolean'
+}
+
+/**
+ * 是否为真正的对象{} new Object
+ * @param {any} obj - 检测的对象
+ * @returns {boolean}
+ */
+export function isPlainObject(obj) {
+ return Object.prototype.toString.call(obj) === '[object Object]'
+}
+
+/**
+ * Function equal to merge with the difference being that no reference
+ * to original objects is kept.
+ *
+ * @see merge
+ * @param {Object} obj1 Object to merge
+ * @returns {Object} Result of all merge properties
+ */
+export function deepMerge(/* obj1, obj2, obj3, ... */) {
+ const result = {}
+ function assignValue(val, key) {
+ if (typeof result[key] === 'object' && typeof val === 'object') {
+ result[key] = deepMerge(result[key], val)
+ } else if (typeof val === 'object') {
+ result[key] = deepMerge({}, val)
+ } else {
+ result[key] = val
+ }
+ }
+ for (let i = 0, l = arguments.length; i < l; i++) {
+ forEach(arguments[i], assignValue)
+ }
+ return result
+}
+
+export function isUndefined(val) {
+ return typeof val === 'undefined'
+}
diff --git a/uni_modules/wu-ui-tools/libs/luch-request/utils/clone.js b/uni_modules/wu-ui-tools/libs/luch-request/utils/clone.js
new file mode 100644
index 0000000..2fee704
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/luch-request/utils/clone.js
@@ -0,0 +1,264 @@
+/* eslint-disable */
+var clone = (function() {
+ 'use strict';
+
+ function _instanceof(obj, type) {
+ return type != null && obj instanceof type;
+ }
+
+ var nativeMap;
+ try {
+ nativeMap = Map;
+ } catch(_) {
+ // maybe a reference error because no `Map`. Give it a dummy value that no
+ // value will ever be an instanceof.
+ nativeMap = function() {};
+ }
+
+ var nativeSet;
+ try {
+ nativeSet = Set;
+ } catch(_) {
+ nativeSet = function() {};
+ }
+
+ var nativePromise;
+ try {
+ nativePromise = Promise;
+ } catch(_) {
+ nativePromise = function() {};
+ }
+
+ /**
+ * Clones (copies) an Object using deep copying.
+ *
+ * This function supports circular references by default, but if you are certain
+ * there are no circular references in your object, you can save some CPU time
+ * by calling clone(obj, false).
+ *
+ * Caution: if `circular` is false and `parent` contains circular references,
+ * your program may enter an infinite loop and crash.
+ *
+ * @param `parent` - the object to be cloned
+ * @param `circular` - set to true if the object to be cloned may contain
+ * circular references. (optional - true by default)
+ * @param `depth` - set to a number if the object is only to be cloned to
+ * a particular depth. (optional - defaults to Infinity)
+ * @param `prototype` - sets the prototype to be used when cloning an object.
+ * (optional - defaults to parent prototype).
+ * @param `includeNonEnumerable` - set to true if the non-enumerable properties
+ * should be cloned as well. Non-enumerable properties on the prototype
+ * chain will be ignored. (optional - false by default)
+ */
+ function clone(parent, circular, depth, prototype, includeNonEnumerable) {
+ if (typeof circular === 'object') {
+ depth = circular.depth;
+ prototype = circular.prototype;
+ includeNonEnumerable = circular.includeNonEnumerable;
+ circular = circular.circular;
+ }
+ // maintain two arrays for circular references, where corresponding parents
+ // and children have the same index
+ var allParents = [];
+ var allChildren = [];
+
+ var useBuffer = typeof Buffer != 'undefined';
+
+ if (typeof circular == 'undefined')
+ circular = true;
+
+ if (typeof depth == 'undefined')
+ depth = Infinity;
+
+ // recurse this function so we don't reset allParents and allChildren
+ function _clone(parent, depth) {
+ // cloning null always returns null
+ if (parent === null)
+ return null;
+
+ if (depth === 0)
+ return parent;
+
+ var child;
+ var proto;
+ if (typeof parent != 'object') {
+ return parent;
+ }
+
+ if (_instanceof(parent, nativeMap)) {
+ child = new nativeMap();
+ } else if (_instanceof(parent, nativeSet)) {
+ child = new nativeSet();
+ } else if (_instanceof(parent, nativePromise)) {
+ child = new nativePromise(function (resolve, reject) {
+ parent.then(function(value) {
+ resolve(_clone(value, depth - 1));
+ }, function(err) {
+ reject(_clone(err, depth - 1));
+ });
+ });
+ } else if (clone.__isArray(parent)) {
+ child = [];
+ } else if (clone.__isRegExp(parent)) {
+ child = new RegExp(parent.source, __getRegExpFlags(parent));
+ if (parent.lastIndex) child.lastIndex = parent.lastIndex;
+ } else if (clone.__isDate(parent)) {
+ child = new Date(parent.getTime());
+ } else if (useBuffer && Buffer.isBuffer(parent)) {
+ if (Buffer.from) {
+ // Node.js >= 5.10.0
+ child = Buffer.from(parent);
+ } else {
+ // Older Node.js versions
+ child = new Buffer(parent.length);
+ parent.copy(child);
+ }
+ return child;
+ } else if (_instanceof(parent, Error)) {
+ child = Object.create(parent);
+ } else {
+ if (typeof prototype == 'undefined') {
+ proto = Object.getPrototypeOf(parent);
+ child = Object.create(proto);
+ }
+ else {
+ child = Object.create(prototype);
+ proto = prototype;
+ }
+ }
+
+ if (circular) {
+ var index = allParents.indexOf(parent);
+
+ if (index != -1) {
+ return allChildren[index];
+ }
+ allParents.push(parent);
+ allChildren.push(child);
+ }
+
+ if (_instanceof(parent, nativeMap)) {
+ parent.forEach(function(value, key) {
+ var keyChild = _clone(key, depth - 1);
+ var valueChild = _clone(value, depth - 1);
+ child.set(keyChild, valueChild);
+ });
+ }
+ if (_instanceof(parent, nativeSet)) {
+ parent.forEach(function(value) {
+ var entryChild = _clone(value, depth - 1);
+ child.add(entryChild);
+ });
+ }
+
+ for (var i in parent) {
+ var attrs = Object.getOwnPropertyDescriptor(parent, i);
+ if (attrs) {
+ child[i] = _clone(parent[i], depth - 1);
+ }
+
+ try {
+ var objProperty = Object.getOwnPropertyDescriptor(parent, i);
+ if (objProperty.set === 'undefined') {
+ // no setter defined. Skip cloning this property
+ continue;
+ }
+ child[i] = _clone(parent[i], depth - 1);
+ } catch(e){
+ if (e instanceof TypeError) {
+ // when in strict mode, TypeError will be thrown if child[i] property only has a getter
+ // we can't do anything about this, other than inform the user that this property cannot be set.
+ continue
+ } else if (e instanceof ReferenceError) {
+ //this may happen in non strict mode
+ continue
+ }
+ }
+
+ }
+
+ if (Object.getOwnPropertySymbols) {
+ var symbols = Object.getOwnPropertySymbols(parent);
+ for (var i = 0; i < symbols.length; i++) {
+ // Don't need to worry about cloning a symbol because it is a primitive,
+ // like a number or string.
+ var symbol = symbols[i];
+ var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
+ if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
+ continue;
+ }
+ child[symbol] = _clone(parent[symbol], depth - 1);
+ Object.defineProperty(child, symbol, descriptor);
+ }
+ }
+
+ if (includeNonEnumerable) {
+ var allPropertyNames = Object.getOwnPropertyNames(parent);
+ for (var i = 0; i < allPropertyNames.length; i++) {
+ var propertyName = allPropertyNames[i];
+ var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
+ if (descriptor && descriptor.enumerable) {
+ continue;
+ }
+ child[propertyName] = _clone(parent[propertyName], depth - 1);
+ Object.defineProperty(child, propertyName, descriptor);
+ }
+ }
+
+ return child;
+ }
+
+ return _clone(parent, depth);
+ }
+
+ /**
+ * Simple flat clone using prototype, accepts only objects, usefull for property
+ * override on FLAT configuration object (no nested props).
+ *
+ * USE WITH CAUTION! This may not behave as you wish if you do not know how this
+ * works.
+ */
+ clone.clonePrototype = function clonePrototype(parent) {
+ if (parent === null)
+ return null;
+
+ var c = function () {};
+ c.prototype = parent;
+ return new c();
+ };
+
+// private utility functions
+
+ function __objToStr(o) {
+ return Object.prototype.toString.call(o);
+ }
+ clone.__objToStr = __objToStr;
+
+ function __isDate(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object Date]';
+ }
+ clone.__isDate = __isDate;
+
+ function __isArray(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object Array]';
+ }
+ clone.__isArray = __isArray;
+
+ function __isRegExp(o) {
+ return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
+ }
+ clone.__isRegExp = __isRegExp;
+
+ function __getRegExpFlags(re) {
+ var flags = '';
+ if (re.global) flags += 'g';
+ if (re.ignoreCase) flags += 'i';
+ if (re.multiline) flags += 'm';
+ return flags;
+ }
+ clone.__getRegExpFlags = __getRegExpFlags;
+
+ return clone;
+})();
+
+export default clone
diff --git a/uni_modules/wu-ui-tools/libs/mixin/button.js b/uni_modules/wu-ui-tools/libs/mixin/button.js
new file mode 100644
index 0000000..0c019c2
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/button.js
@@ -0,0 +1,13 @@
+export default {
+ props: {
+ lang: String,
+ sessionFrom: String,
+ sendMessageTitle: String,
+ sendMessagePath: String,
+ sendMessageImg: String,
+ showMessageCard: Boolean,
+ appParameter: String,
+ formType: String,
+ openType: String
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/mixin/mixin.js b/uni_modules/wu-ui-tools/libs/mixin/mixin.js
new file mode 100644
index 0000000..217f534
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/mixin.js
@@ -0,0 +1,188 @@
+import * as index from '../function/index.js';
+import * as test from '../function/test.js';
+
+export default {
+ // 定义每个组件都可能需要用到的外部样式以及类名
+ props: {
+ // 每个组件都有的父组件传递的样式,可以为字符串或者对象形式
+ customStyle: {
+ type: [Object, String],
+ default: () => ({})
+ },
+ customClass: {
+ type: String,
+ default: ''
+ },
+ // 跳转的页面路径
+ url: {
+ type: String,
+ default: ''
+ },
+ // 页面跳转的类型
+ linkType: {
+ type: String,
+ default: 'navigateTo'
+ }
+ },
+ data() {
+ return {}
+ },
+ onLoad() {
+ // getRect挂载到$w上,因为这方法需要使用in(this),所以无法把它独立成一个单独的文件导出
+ this.$w.getRect = this.$wuGetRect;
+ },
+ created() {
+ // 组件当中,只有created声明周期,为了能在组件使用,故也在created中将方法挂载到$w
+ this.$w.getRect = this.$wuGetRect;
+ },
+ computed: {
+ $w() {
+ return {
+ ...index,
+ test
+ }
+ },
+ /**
+ * 生成bem规则类名
+ * 由于微信小程序,H5,nvue之间绑定class的差异,无法通过:class="[bem()]"的形式进行同用
+ * 故采用如下折中做法,最后返回的是数组(一般平台)或字符串(支付宝和字节跳动平台),类似['a', 'b', 'c']或'a b c'的形式
+ * @param {String} name 组件名称
+ * @param {Array} fixed 一直会存在的类名
+ * @param {Array} change 会根据变量值为true或者false而出现或者隐藏的类名
+ * @returns {Array|string}
+ */
+ bem() {
+ return function(name, fixed, change) {
+ // 类名前缀
+ const prefix = `wu-${name}--`
+ const classes = {}
+ if (fixed) {
+ fixed.map((item) => {
+ // 这里的类名,会一直存在
+ classes[prefix + this[item]] = true
+ })
+ }
+ if (change) {
+ change.map((item) => {
+ // 这里的类名,会根据this[item]的值为true或者false,而进行添加或者移除某一个类
+ this[item] ? (classes[prefix + item] = this[item]) : (delete classes[prefix + item])
+ })
+ }
+ return Object.keys(classes)
+ // 支付宝,头条小程序无法动态绑定一个数组类名,否则解析出来的结果会带有",",而导致失效
+ // #ifdef MP-ALIPAY || MP-TOUTIAO || MP-LARK || MP-BAIDU
+ .join(' ')
+ // #endif
+ }
+ }
+ },
+ methods: {
+ // 跳转某一个页面
+ openPage(urlKey = 'url') {
+ const url = this[urlKey]
+ if (url) {
+ // 执行类似uni.navigateTo的方法
+ uni[this.linkType]({
+ url
+ })
+ }
+ },
+ // 查询节点信息
+ // 目前此方法在支付宝小程序中无法获取组件跟接点的尺寸,为支付宝的bug(2020-07-21)
+ // 解决办法为在组件根部再套一个没有任何作用的view元素
+ $wuGetRect(selector, all) {
+ return new Promise((resolve) => {
+ uni.createSelectorQuery()
+ .in(this)[all ? 'selectAll' : 'select'](selector)
+ .boundingClientRect((rect) => {
+ if (all && Array.isArray(rect) && rect.length) {
+ resolve(rect)
+ }
+ if (!all && rect) {
+ resolve(rect)
+ }
+ })
+ .exec()
+ })
+ },
+ // 查询节点布局是否相交
+ IntersectionObserver(_this, nodeName, callback) {
+ this.$nextTick(() => {
+ // #ifndef APP-NVUE || H5
+ let intersectionObserver = uni.createIntersectionObserver(_this)
+ intersectionObserver.relativeToViewport({
+ bottom: Number(this.lazyLoadRootMargin)
+ }).observe(nodeName, res => {
+ callback(res, ()=>intersectionObserver.disconnect());
+ })
+ // #endif
+ // #ifdef H5
+ if (!window.__wu_observedComponents) window.__wu_observedComponents = new Map(); // 用于存储元素及其对应的回调函数
+ if (!window.__wu_IntersectionObserver) {
+ window.__wu_IntersectionObserver = new IntersectionObserver((entries) => {
+ entries.forEach(entry => {
+ const callback = window.__wu_observedComponents.get(entry.target);
+ if (callback) {
+ callback(entry, ()=>{
+ window.__wu_IntersectionObserver.unobserve(entry.target);
+ window.__wu_observedComponents.delete(entry.target);
+ });
+ }
+ });
+ }, {
+ root: null,
+ rootMargin: Number(this.lazyLoadRootMargin) + 'px',
+ threshold: 0
+ });
+ }
+ window.__wu_observedComponents.set(_this.$el, callback);
+ window.__wu_IntersectionObserver.observe(_this.$el)
+ // #endif
+ })
+ },
+ getParentData(parentName = '') {
+ // 避免在created中去定义parent变量
+ if (!this.parent) this.parent = {}
+ // 这里的本质原理是,通过获取父组件实例(也即类似wu-radio的父组件wu-radio-group的this)
+ // 将父组件this中对应的参数,赋值给本组件(wu-radio的this)的parentData对象中对应的属性
+ // 之所以需要这么做,是因为所有端中,头条小程序不支持通过this.parent.xxx去监听父组件参数的变化
+ // 此处并不会自动更新子组件的数据,而是依赖父组件wu-radio-group去监听data的变化,手动调用更新子组件的方法去重新获取
+ this.parent = this.$w.$parent.call(this, parentName)
+ if (this.parent.children) {
+ // 如果父组件的children不存在本组件的实例,才将本实例添加到父组件的children中
+ this.parent.children.indexOf(this) === -1 && this.parent.children.push(this)
+ }
+ if (this.parent && this.parentData) {
+ // 历遍parentData中的属性,将parent中的同名属性赋值给parentData
+ Object.keys(this.parentData).map((key) => {
+ this.parentData[key] = this.parent[key]
+ })
+ }
+ },
+ // 阻止事件冒泡
+ preventEvent(e) {
+ e && typeof(e.stopPropagation) === 'function' && e.stopPropagation()
+ },
+ // 空操作
+ noop(e) {
+ this.preventEvent(e)
+ }
+ },
+ onReachBottom() {
+ uni.$emit('wuOnReachBottom')
+ },
+ beforeDestroy() {
+ // 判断当前页面是否存在parent和chldren,一般在checkbox和checkbox-group父子联动的场景会有此情况
+ // 组件销毁时,移除子组件在父组件children数组中的实例,释放资源,避免数据混乱
+ if (this.parent && test.array(this.parent.children)) {
+ // 组件销毁时,移除父组件中的children数组中对应的实例
+ const childrenList = this.parent.children
+ childrenList.map((child, index) => {
+ // 如果相等,则移除
+ if (child === this) {
+ childrenList.splice(index, 1)
+ }
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js b/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js
new file mode 100644
index 0000000..90b6903
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/mpMixin.js
@@ -0,0 +1,8 @@
+export default {
+ // #ifdef MP-WEIXIN
+ // 将自定义节点设置成虚拟的(去掉自定义组件包裹层),更加接近Vue组件的表现,能更好的使用flex属性
+ options: {
+ virtualHost: true
+ }
+ // #endif
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/mixin/mpShare.js b/uni_modules/wu-ui-tools/libs/mixin/mpShare.js
new file mode 100644
index 0000000..0c5e959
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/mpShare.js
@@ -0,0 +1,13 @@
+export default {
+ onLoad() {
+ // 设置默认的转发参数
+ uni.$wu.mpShare = {
+ title: '', // 默认为小程序名称
+ path: '', // 默认为当前页面路径
+ imageUrl: '' // 默认为当前页面的截图
+ }
+ },
+ onShareAppMessage() {
+ return uni.$wu.mpShare
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/libs/mixin/openType.js b/uni_modules/wu-ui-tools/libs/mixin/openType.js
new file mode 100644
index 0000000..e6ffe3d
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/openType.js
@@ -0,0 +1,44 @@
+export default {
+ props: {
+ openType: String
+ },
+ emits: ['getphonenumber','getuserinfo','error','opensetting','launchapp','contact','chooseavatar','addgroupapp','chooseaddress','subscribe','login','im'],
+ methods: {
+ onGetPhoneNumber(event) {
+ this.$emit('getphonenumber', event.detail)
+ },
+ onGetUserInfo(event) {
+ this.$emit('getuserinfo', event.detail)
+ },
+ onError(event) {
+ this.$emit('error', event.detail)
+ },
+ onOpenSetting(event) {
+ this.$emit('opensetting', event.detail)
+ },
+ onLaunchApp(event) {
+ this.$emit('launchapp', event.detail)
+ },
+ onContact(event) {
+ this.$emit('contact', event.detail)
+ },
+ onChooseavatar(event) {
+ this.$emit('chooseavatar', event.detail)
+ },
+ onAddgroupapp(event) {
+ this.$emit('addgroupapp', event.detail)
+ },
+ onChooseaddress(event) {
+ this.$emit('chooseaddress', event.detail)
+ },
+ onSubscribe(event) {
+ this.$emit('subscribe', event.detail)
+ },
+ onLogin(event) {
+ this.$emit('login', event.detail)
+ },
+ onIm(event) {
+ this.$emit('im', event.detail)
+ }
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/mixin/touch.js b/uni_modules/wu-ui-tools/libs/mixin/touch.js
new file mode 100644
index 0000000..0ecbd88
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/mixin/touch.js
@@ -0,0 +1,59 @@
+const MIN_DISTANCE = 10
+
+function getDirection(x, y) {
+ if (x > y && x > MIN_DISTANCE) {
+ return 'horizontal'
+ }
+ if (y > x && y > MIN_DISTANCE) {
+ return 'vertical'
+ }
+ return ''
+}
+
+export default {
+ methods: {
+ getTouchPoint(e) {
+ if (!e) {
+ return {
+ x: 0,
+ y: 0
+ }
+ } if (e.touches && e.touches[0]) {
+ return {
+ x: e.touches[0].pageX,
+ y: e.touches[0].pageY
+ }
+ } if (e.changedTouches && e.changedTouches[0]) {
+ return {
+ x: e.changedTouches[0].pageX,
+ y: e.changedTouches[0].pageY
+ }
+ }
+ return {
+ x: e.clientX || 0,
+ y: e.clientY || 0
+ }
+ },
+ resetTouchStatus() {
+ this.direction = ''
+ this.deltaX = 0
+ this.deltaY = 0
+ this.offsetX = 0
+ this.offsetY = 0
+ },
+ touchStart(event) {
+ this.resetTouchStatus()
+ const touch = this.getTouchPoint(event)
+ this.startX = touch.x
+ this.startY = touch.y
+ },
+ touchMove(event) {
+ const touch = this.getTouchPoint(event)
+ this.deltaX = touch.x - this.startX
+ this.deltaY = touch.y - this.startY
+ this.offsetX = Math.abs(this.deltaX)
+ this.offsetY = Math.abs(this.deltaY)
+ this.direction = this.direction || getDirection(this.offsetX, this.offsetY)
+ }
+ }
+}
diff --git a/uni_modules/wu-ui-tools/libs/util/async-validator.js b/uni_modules/wu-ui-tools/libs/util/async-validator.js
new file mode 100644
index 0000000..9e114df
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/util/async-validator.js
@@ -0,0 +1,1343 @@
+function _extends() {
+ _extends = Object.assign || function (target) {
+ for (let i = 1; i < arguments.length; i++) {
+ const source = arguments[i]
+
+ for (const key in source) {
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
+ target[key] = source[key]
+ }
+ }
+ }
+
+ return target
+ }
+
+ return _extends.apply(this, arguments)
+}
+
+/* eslint no-console:0 */
+const formatRegExp = /%[sdj%]/g
+let warning = function warning() {} // don't print warning message when in production env or node runtime
+
+if (typeof process !== 'undefined' && process.env && process.env.NODE_ENV !== 'production' && typeof window
+ !== 'undefined' && typeof document !== 'undefined') {
+ warning = function warning(type, errors) {
+ if (typeof console !== 'undefined' && console.warn) {
+ if (errors.every((e) => typeof e === 'string')) {
+ console.warn(type, errors)
+ }
+ }
+ }
+}
+
+function convertFieldsError(errors) {
+ if (!errors || !errors.length) return null
+ const fields = {}
+ errors.forEach((error) => {
+ const { field } = error
+ fields[field] = fields[field] || []
+ fields[field].push(error)
+ })
+ return fields
+}
+
+function format() {
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
+ args[_key] = arguments[_key]
+ }
+
+ let i = 1
+ const f = args[0]
+ const len = args.length
+
+ if (typeof f === 'function') {
+ return f.apply(null, args.slice(1))
+ }
+
+ if (typeof f === 'string') {
+ let str = String(f).replace(formatRegExp, (x) => {
+ if (x === '%%') {
+ return '%'
+ }
+
+ if (i >= len) {
+ return x
+ }
+
+ switch (x) {
+ case '%s':
+ return String(args[i++])
+
+ case '%d':
+ return Number(args[i++])
+
+ case '%j':
+ try {
+ return JSON.stringify(args[i++])
+ } catch (_) {
+ return '[Circular]'
+ }
+
+ break
+
+ default:
+ return x
+ }
+ })
+
+ for (let arg = args[i]; i < len; arg = args[++i]) {
+ str += ` ${arg}`
+ }
+
+ return str
+ }
+
+ return f
+}
+
+function isNativeStringType(type) {
+ return type === 'string' || type === 'url' || type === 'hex' || type === 'email' || type === 'pattern'
+}
+
+function isEmptyValue(value, type) {
+ if (value === undefined || value === null) {
+ return true
+ }
+
+ if (type === 'array' && Array.isArray(value) && !value.length) {
+ return true
+ }
+
+ if (isNativeStringType(type) && typeof value === 'string' && !value) {
+ return true
+ }
+
+ return false
+}
+
+function asyncParallelArray(arr, func, callback) {
+ const results = []
+ let total = 0
+ const arrLength = arr.length
+
+ function count(errors) {
+ results.push.apply(results, errors)
+ total++
+
+ if (total === arrLength) {
+ callback(results)
+ }
+ }
+
+ arr.forEach((a) => {
+ func(a, count)
+ })
+}
+
+function asyncSerialArray(arr, func, callback) {
+ let index = 0
+ const arrLength = arr.length
+
+ function next(errors) {
+ if (errors && errors.length) {
+ callback(errors)
+ return
+ }
+
+ const original = index
+ index += 1
+
+ if (original < arrLength) {
+ func(arr[original], next)
+ } else {
+ callback([])
+ }
+ }
+
+ next([])
+}
+
+function flattenObjArr(objArr) {
+ const ret = []
+ Object.keys(objArr).forEach((k) => {
+ ret.push.apply(ret, objArr[k])
+ })
+ return ret
+}
+
+function asyncMap(objArr, option, func, callback) {
+ if (option.first) {
+ const _pending = new Promise((resolve, reject) => {
+ const next = function next(errors) {
+ callback(errors)
+ return errors.length ? reject({
+ errors,
+ fields: convertFieldsError(errors)
+ }) : resolve()
+ }
+
+ const flattenArr = flattenObjArr(objArr)
+ asyncSerialArray(flattenArr, func, next)
+ })
+
+ _pending.catch((e) => e)
+
+ return _pending
+ }
+
+ let firstFields = option.firstFields || []
+
+ if (firstFields === true) {
+ firstFields = Object.keys(objArr)
+ }
+
+ const objArrKeys = Object.keys(objArr)
+ const objArrLength = objArrKeys.length
+ let total = 0
+ const results = []
+ const pending = new Promise((resolve, reject) => {
+ const next = function next(errors) {
+ results.push.apply(results, errors)
+ total++
+
+ if (total === objArrLength) {
+ callback(results)
+ return results.length ? reject({
+ errors: results,
+ fields: convertFieldsError(results)
+ }) : resolve()
+ }
+ }
+
+ if (!objArrKeys.length) {
+ callback(results)
+ resolve()
+ }
+
+ objArrKeys.forEach((key) => {
+ const arr = objArr[key]
+
+ if (firstFields.indexOf(key) !== -1) {
+ asyncSerialArray(arr, func, next)
+ } else {
+ asyncParallelArray(arr, func, next)
+ }
+ })
+ })
+ pending.catch((e) => e)
+ return pending
+}
+
+function complementError(rule) {
+ return function (oe) {
+ if (oe && oe.message) {
+ oe.field = oe.field || rule.fullField
+ return oe
+ }
+
+ return {
+ message: typeof oe === 'function' ? oe() : oe,
+ field: oe.field || rule.fullField
+ }
+ }
+}
+
+function deepMerge(target, source) {
+ if (source) {
+ for (const s in source) {
+ if (source.hasOwnProperty(s)) {
+ const value = source[s]
+
+ if (typeof value === 'object' && typeof target[s] === 'object') {
+ target[s] = { ...target[s], ...value }
+ } else {
+ target[s] = value
+ }
+ }
+ }
+ }
+
+ return target
+}
+
+/**
+ * Rule for validating required fields.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function required(rule, value, source, errors, options, type) {
+ if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) {
+ errors.push(format(options.messages.required, rule.fullField))
+ }
+}
+
+/**
+ * Rule for validating whitespace.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function whitespace(rule, value, source, errors, options) {
+ if (/^\s+$/.test(value) || value === '') {
+ errors.push(format(options.messages.whitespace, rule.fullField))
+ }
+}
+
+/* eslint max-len:0 */
+
+const pattern = {
+ // http://emailregex.com/
+ email: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
+ url: new RegExp(
+ '^(?!mailto:)(?:(?:http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
+ 'i'
+ ),
+ hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
+}
+var types = {
+ integer: function integer(value) {
+ return /^(-)?\d+$/.test(value);
+ },
+ float: function float(value) {
+ return /^(-)?\d+(\.\d+)?$/.test(value);
+ },
+ array: function array(value) {
+ return Array.isArray(value)
+ },
+ regexp: function regexp(value) {
+ if (value instanceof RegExp) {
+ return true
+ }
+
+ try {
+ return !!new RegExp(value)
+ } catch (e) {
+ return false
+ }
+ },
+ date: function date(value) {
+ return typeof value.getTime === 'function' && typeof value.getMonth === 'function' && typeof value.getYear
+ === 'function'
+ },
+ number: function number(value) {
+ if (isNaN(value)) {
+ return false
+ }
+
+ // 修改源码,将字符串数值先转为数值
+ return typeof +value === 'number'
+ },
+ object: function object(value) {
+ return typeof value === 'object' && !types.array(value)
+ },
+ method: function method(value) {
+ return typeof value === 'function'
+ },
+ email: function email(value) {
+ return typeof value === 'string' && !!value.match(pattern.email) && value.length < 255
+ },
+ url: function url(value) {
+ return typeof value === 'string' && !!value.match(pattern.url)
+ },
+ hex: function hex(value) {
+ return typeof value === 'string' && !!value.match(pattern.hex)
+ }
+}
+/**
+ * Rule for validating the type of a value.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function type(rule, value, source, errors, options) {
+ if (rule.required && value === undefined) {
+ required(rule, value, source, errors, options)
+ return
+ }
+
+ const custom = ['integer', 'float', 'array', 'regexp', 'object', 'method', 'email', 'number', 'date', 'url', 'hex']
+ const ruleType = rule.type
+
+ if (custom.indexOf(ruleType) > -1) {
+ if (!types[ruleType](value)) {
+ errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type))
+ } // straight typeof check
+ } else if (ruleType && typeof value !== rule.type) {
+ errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type))
+ }
+}
+
+/**
+ * Rule for validating minimum and maximum allowed values.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function range(rule, value, source, errors, options) {
+ const len = typeof rule.len === 'number'
+ const min = typeof rule.min === 'number'
+ const max = typeof rule.max === 'number' // 正则匹配码点范围从U+010000一直到U+10FFFF的文字(补充平面Supplementary Plane)
+
+ const spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g
+ let val = value
+ let key = null
+ const num = typeof value === 'number'
+ const str = typeof value === 'string'
+ const arr = Array.isArray(value)
+
+ if (num) {
+ key = 'number'
+ } else if (str) {
+ key = 'string'
+ } else if (arr) {
+ key = 'array'
+ } // if the value is not of a supported type for range validation
+ // the validation rule rule should use the
+ // type property to also test for a particular type
+
+ if (!key) {
+ return false
+ }
+
+ if (arr) {
+ val = value.length
+ }
+
+ if (str) {
+ // 处理码点大于U+010000的文字length属性不准确的bug,如"𠮷𠮷𠮷".lenght !== 3
+ val = value.replace(spRegexp, '_').length
+ }
+
+ if (len) {
+ if (val !== rule.len) {
+ errors.push(format(options.messages[key].len, rule.fullField, rule.len))
+ }
+ } else if (min && !max && val < rule.min) {
+ errors.push(format(options.messages[key].min, rule.fullField, rule.min))
+ } else if (max && !min && val > rule.max) {
+ errors.push(format(options.messages[key].max, rule.fullField, rule.max))
+ } else if (min && max && (val < rule.min || val > rule.max)) {
+ errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max))
+ }
+}
+
+const ENUM = 'enum'
+/**
+ * Rule for validating a value exists in an enumerable list.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function enumerable(rule, value, source, errors, options) {
+ rule[ENUM] = Array.isArray(rule[ENUM]) ? rule[ENUM] : []
+
+ if (rule[ENUM].indexOf(value) === -1) {
+ errors.push(format(options.messages[ENUM], rule.fullField, rule[ENUM].join(', ')))
+ }
+}
+
+/**
+ * Rule for validating a regular expression pattern.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param source The source object being validated.
+ * @param errors An array of errors that this rule may add
+ * validation errors to.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function pattern$1(rule, value, source, errors, options) {
+ if (rule.pattern) {
+ if (rule.pattern instanceof RegExp) {
+ // if a RegExp instance is passed, reset `lastIndex` in case its `global`
+ // flag is accidentally set to `true`, which in a validation scenario
+ // is not necessary and the result might be misleading
+ rule.pattern.lastIndex = 0
+
+ if (!rule.pattern.test(value)) {
+ errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern))
+ }
+ } else if (typeof rule.pattern === 'string') {
+ const _pattern = new RegExp(rule.pattern)
+
+ if (!_pattern.test(value)) {
+ errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern))
+ }
+ }
+ }
+}
+
+const rules = {
+ required,
+ whitespace,
+ type,
+ range,
+ enum: enumerable,
+ pattern: pattern$1
+}
+
+/**
+ * Performs validation for string types.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function string(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value, 'string') && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options, 'string')
+
+ if (!isEmptyValue(value, 'string')) {
+ rules.type(rule, value, source, errors, options)
+ rules.range(rule, value, source, errors, options)
+ rules.pattern(rule, value, source, errors, options)
+
+ if (rule.whitespace === true) {
+ rules.whitespace(rule, value, source, errors, options)
+ }
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a function.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function method(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a number.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function number(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (value === '') {
+ value = undefined
+ }
+
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ rules.range(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a boolean.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function _boolean(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates the regular expression type.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function regexp(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (!isEmptyValue(value)) {
+ rules.type(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a number is an integer.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function integer(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ rules.range(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a number is a floating point number.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function floatFn(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ rules.range(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates an array.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function array(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value, 'array') && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options, 'array')
+
+ if (!isEmptyValue(value, 'array')) {
+ rules.type(rule, value, source, errors, options)
+ rules.range(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates an object.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function object(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules.type(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+const ENUM$1 = 'enum'
+/**
+ * Validates an enumerable list.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function enumerable$1(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (value !== undefined) {
+ rules[ENUM$1](rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Validates a regular expression pattern.
+ *
+ * Performs validation when a rule only contains
+ * a pattern property but is not declared as a string type.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function pattern$2(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value, 'string') && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (!isEmptyValue(value, 'string')) {
+ rules.pattern(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+function date(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+
+ if (!isEmptyValue(value)) {
+ let dateObject
+
+ if (typeof value === 'number') {
+ dateObject = new Date(value)
+ } else {
+ dateObject = value
+ }
+
+ rules.type(rule, dateObject, source, errors, options)
+
+ if (dateObject) {
+ rules.range(rule, dateObject.getTime(), source, errors, options)
+ }
+ }
+ }
+
+ callback(errors)
+}
+
+function required$1(rule, value, callback, source, options) {
+ const errors = []
+ const type = Array.isArray(value) ? 'array' : typeof value
+ rules.required(rule, value, source, errors, options, type)
+ callback(errors)
+}
+
+function type$1(rule, value, callback, source, options) {
+ const ruleType = rule.type
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value, ruleType) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options, ruleType)
+
+ if (!isEmptyValue(value, ruleType)) {
+ rules.type(rule, value, source, errors, options)
+ }
+ }
+
+ callback(errors)
+}
+
+/**
+ * Performs validation for any type.
+ *
+ * @param rule The validation rule.
+ * @param value The value of the field on the source object.
+ * @param callback The callback function.
+ * @param source The source object being validated.
+ * @param options The validation options.
+ * @param options.messages The validation messages.
+ */
+
+function any(rule, value, callback, source, options) {
+ const errors = []
+ const validate = rule.required || !rule.required && source.hasOwnProperty(rule.field)
+
+ if (validate) {
+ if (isEmptyValue(value) && !rule.required) {
+ return callback()
+ }
+
+ rules.required(rule, value, source, errors, options)
+ }
+
+ callback(errors)
+}
+
+const validators = {
+ string,
+ method,
+ number,
+ boolean: _boolean,
+ regexp,
+ integer,
+ float: floatFn,
+ array,
+ object,
+ enum: enumerable$1,
+ pattern: pattern$2,
+ date,
+ url: type$1,
+ hex: type$1,
+ email: type$1,
+ required: required$1,
+ any
+}
+
+function newMessages() {
+ return {
+ default: 'Validation error on field %s',
+ required: '%s is required',
+ enum: '%s must be one of %s',
+ whitespace: '%s cannot be empty',
+ date: {
+ format: '%s date %s is invalid for format %s',
+ parse: '%s date could not be parsed, %s is invalid ',
+ invalid: '%s date %s is invalid'
+ },
+ types: {
+ string: '%s is not a %s',
+ method: '%s is not a %s (function)',
+ array: '%s is not an %s',
+ object: '%s is not an %s',
+ number: '%s is not a %s',
+ date: '%s is not a %s',
+ boolean: '%s is not a %s',
+ integer: '%s is not an %s',
+ float: '%s is not a %s',
+ regexp: '%s is not a valid %s',
+ email: '%s is not a valid %s',
+ url: '%s is not a valid %s',
+ hex: '%s is not a valid %s'
+ },
+ string: {
+ len: '%s must be exactly %s characters',
+ min: '%s must be at least %s characters',
+ max: '%s cannot be longer than %s characters',
+ range: '%s must be between %s and %s characters'
+ },
+ number: {
+ len: '%s must equal %s',
+ min: '%s cannot be less than %s',
+ max: '%s cannot be greater than %s',
+ range: '%s must be between %s and %s'
+ },
+ array: {
+ len: '%s must be exactly %s in length',
+ min: '%s cannot be less than %s in length',
+ max: '%s cannot be greater than %s in length',
+ range: '%s must be between %s and %s in length'
+ },
+ pattern: {
+ mismatch: '%s value %s does not match pattern %s'
+ },
+ clone: function clone() {
+ const cloned = JSON.parse(JSON.stringify(this))
+ cloned.clone = this.clone
+ return cloned
+ }
+ }
+}
+const messages = newMessages()
+
+/**
+ * Encapsulates a validation schema.
+ *
+ * @param descriptor An object declaring validation rules
+ * for this schema.
+ */
+
+function Schema(descriptor) {
+ this.rules = null
+ this._messages = messages
+ this.define(descriptor)
+}
+
+Schema.prototype = {
+ messages: function messages(_messages) {
+ if (_messages) {
+ this._messages = deepMerge(newMessages(), _messages)
+ }
+
+ return this._messages
+ },
+ define: function define(rules) {
+ if (!rules) {
+ throw new Error('Cannot configure a schema with no rules')
+ }
+
+ if (typeof rules !== 'object' || Array.isArray(rules)) {
+ throw new Error('Rules must be an object')
+ }
+
+ this.rules = {}
+ let z
+ let item
+
+ for (z in rules) {
+ if (rules.hasOwnProperty(z)) {
+ item = rules[z]
+ this.rules[z] = Array.isArray(item) ? item : [item]
+ }
+ }
+ },
+ validate: function validate(source_, o, oc) {
+ const _this = this
+
+ if (o === void 0) {
+ o = {}
+ }
+
+ if (oc === void 0) {
+ oc = function oc() {}
+ }
+
+ let source = source_
+ let options = o
+ let callback = oc
+
+ if (typeof options === 'function') {
+ callback = options
+ options = {}
+ }
+
+ if (!this.rules || Object.keys(this.rules).length === 0) {
+ if (callback) {
+ callback()
+ }
+
+ return Promise.resolve()
+ }
+
+ function complete(results) {
+ let i
+ let errors = []
+ let fields = {}
+
+ function add(e) {
+ if (Array.isArray(e)) {
+ let _errors
+
+ errors = (_errors = errors).concat.apply(_errors, e)
+ } else {
+ errors.push(e)
+ }
+ }
+
+ for (i = 0; i < results.length; i++) {
+ add(results[i])
+ }
+
+ if (!errors.length) {
+ errors = null
+ fields = null
+ } else {
+ fields = convertFieldsError(errors)
+ }
+
+ callback(errors, fields)
+ }
+
+ if (options.messages) {
+ let messages$1 = this.messages()
+
+ if (messages$1 === messages) {
+ messages$1 = newMessages()
+ }
+
+ deepMerge(messages$1, options.messages)
+ options.messages = messages$1
+ } else {
+ options.messages = this.messages()
+ }
+
+ let arr
+ let value
+ const series = {}
+ const keys = options.keys || Object.keys(this.rules)
+ keys.forEach((z) => {
+ arr = _this.rules[z]
+ value = source[z]
+ arr.forEach((r) => {
+ let rule = r
+
+ if (typeof rule.transform === 'function') {
+ if (source === source_) {
+ source = { ...source }
+ }
+
+ value = source[z] = rule.transform(value)
+ }
+
+ if (typeof rule === 'function') {
+ rule = {
+ validator: rule
+ }
+ } else {
+ rule = { ...rule }
+ }
+
+ rule.validator = _this.getValidationMethod(rule)
+ rule.field = z
+ rule.fullField = rule.fullField || z
+ rule.type = _this.getType(rule)
+
+ if (!rule.validator) {
+ return
+ }
+
+ series[z] = series[z] || []
+ series[z].push({
+ rule,
+ value,
+ source,
+ field: z
+ })
+ })
+ })
+ const errorFields = {}
+ return asyncMap(series, options, (data, doIt) => {
+ const { rule } = data
+ let deep = (rule.type === 'object' || rule.type === 'array') && (typeof rule.fields === 'object' || typeof rule.defaultField
+ === 'object')
+ deep = deep && (rule.required || !rule.required && data.value)
+ rule.field = data.field
+
+ function addFullfield(key, schema) {
+ return { ...schema, fullField: `${rule.fullField}.${key}` }
+ }
+
+ function cb(e) {
+ if (e === void 0) {
+ e = []
+ }
+
+ let errors = e
+
+ if (!Array.isArray(errors)) {
+ errors = [errors]
+ }
+
+ if (!options.suppressWarning && errors.length) {
+ Schema.warning('async-validator:', errors)
+ }
+
+ if (errors.length && rule.message) {
+ errors = [].concat(rule.message)
+ }
+
+ errors = errors.map(complementError(rule))
+
+ if (options.first && errors.length) {
+ errorFields[rule.field] = 1
+ return doIt(errors)
+ }
+
+ if (!deep) {
+ doIt(errors)
+ } else {
+ // if rule is required but the target object
+ // does not exist fail at the rule level and don't
+ // go deeper
+ if (rule.required && !data.value) {
+ if (rule.message) {
+ errors = [].concat(rule.message).map(complementError(rule))
+ } else if (options.error) {
+ errors = [options.error(rule, format(options.messages.required, rule.field))]
+ } else {
+ errors = []
+ }
+
+ return doIt(errors)
+ }
+
+ let fieldsSchema = {}
+
+ if (rule.defaultField) {
+ for (const k in data.value) {
+ if (data.value.hasOwnProperty(k)) {
+ fieldsSchema[k] = rule.defaultField
+ }
+ }
+ }
+
+ fieldsSchema = { ...fieldsSchema, ...data.rule.fields }
+
+ for (const f in fieldsSchema) {
+ if (fieldsSchema.hasOwnProperty(f)) {
+ const fieldSchema = Array.isArray(fieldsSchema[f]) ? fieldsSchema[f] : [fieldsSchema[f]]
+ fieldsSchema[f] = fieldSchema.map(addFullfield.bind(null, f))
+ }
+ }
+
+ const schema = new Schema(fieldsSchema)
+ schema.messages(options.messages)
+
+ if (data.rule.options) {
+ data.rule.options.messages = options.messages
+ data.rule.options.error = options.error
+ }
+
+ schema.validate(data.value, data.rule.options || options, (errs) => {
+ const finalErrors = []
+
+ if (errors && errors.length) {
+ finalErrors.push.apply(finalErrors, errors)
+ }
+
+ if (errs && errs.length) {
+ finalErrors.push.apply(finalErrors, errs)
+ }
+
+ doIt(finalErrors.length ? finalErrors : null)
+ })
+ }
+ }
+
+ let res
+
+ if (rule.asyncValidator) {
+ res = rule.asyncValidator(rule, data.value, cb, data.source, options)
+ } else if (rule.validator) {
+ res = rule.validator(rule, data.value, cb, data.source, options)
+
+ if (res === true) {
+ cb()
+ } else if (res === false) {
+ cb(rule.message || `${rule.field} fails`)
+ } else if (res instanceof Array) {
+ cb(res)
+ } else if (res instanceof Error) {
+ cb(res.message)
+ }
+ }
+
+ if (res && res.then) {
+ res.then(() => cb(), (e) => cb(e))
+ }
+ }, (results) => {
+ complete(results)
+ })
+ },
+ getType: function getType(rule) {
+ if (rule.type === undefined && rule.pattern instanceof RegExp) {
+ rule.type = 'pattern'
+ }
+
+ if (typeof rule.validator !== 'function' && rule.type && !validators.hasOwnProperty(rule.type)) {
+ throw new Error(format('Unknown rule type %s', rule.type))
+ }
+
+ return rule.type || 'string'
+ },
+ getValidationMethod: function getValidationMethod(rule) {
+ if (typeof rule.validator === 'function') {
+ return rule.validator
+ }
+
+ const keys = Object.keys(rule)
+ const messageIndex = keys.indexOf('message')
+
+ if (messageIndex !== -1) {
+ keys.splice(messageIndex, 1)
+ }
+
+ if (keys.length === 1 && keys[0] === 'required') {
+ return validators.required
+ }
+
+ return validators[this.getType(rule)] || false
+ }
+}
+
+Schema.register = function register(type, validator) {
+ if (typeof validator !== 'function') {
+ throw new Error('Cannot register a validator by type, validator is not a function')
+ }
+
+ validators[type] = validator
+}
+
+Schema.warning = warning
+Schema.messages = messages
+
+export default Schema
+// # sourceMappingURL=index.js.map
diff --git a/uni_modules/wu-ui-tools/libs/util/dayjs.js b/uni_modules/wu-ui-tools/libs/util/dayjs.js
new file mode 100644
index 0000000..e360959
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/util/dayjs.js
@@ -0,0 +1,218 @@
+var __getOwnPropNames = Object.getOwnPropertyNames;
+var __commonJS = (cb, mod) => function __require() {
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
+};
+
+// C:/Users/LP/Downloads/wuui-plus_3.1.27_example/node_modules/dayjs/dayjs.min.js
+var require_dayjs_min = __commonJS({
+ "C:/Users/LP/Downloads/wuui-plus_3.1.27_example/node_modules/dayjs/dayjs.min.js"(exports, module) {
+ !function(t, e) {
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
+ }(exports, function() {
+ "use strict";
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
+ } }, m = function(t2, e2, n2) {
+ var r2 = String(t2);
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
+ }, v = { s: m, z: function(t2) {
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
+ }, m: function t2(e2, n2) {
+ if (e2.date() < n2.date())
+ return -t2(n2, e2);
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
+ }, a: function(t2) {
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
+ }, p: function(t2) {
+ return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
+ }, u: function(t2) {
+ return void 0 === t2;
+ } }, g = "en", D = {};
+ D[g] = M;
+ var p = function(t2) {
+ return t2 instanceof _;
+ }, S = function t2(e2, n2, r2) {
+ var i2;
+ if (!e2)
+ return g;
+ if ("string" == typeof e2) {
+ var s2 = e2.toLowerCase();
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
+ var u2 = e2.split("-");
+ if (!i2 && u2.length > 1)
+ return t2(u2[0]);
+ } else {
+ var a2 = e2.name;
+ D[a2] = e2, i2 = a2;
+ }
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
+ }, w = function(t2, e2) {
+ if (p(t2))
+ return t2.clone();
+ var n2 = "object" == typeof e2 ? e2 : {};
+ return n2.date = t2, n2.args = arguments, new _(n2);
+ }, O = v;
+ O.l = S, O.i = p, O.w = function(t2, e2) {
+ return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
+ };
+ var _ = function() {
+ function M2(t2) {
+ this.$L = S(t2.locale, null, true), this.parse(t2);
+ }
+ var m2 = M2.prototype;
+ return m2.parse = function(t2) {
+ this.$d = function(t3) {
+ var e2 = t3.date, n2 = t3.utc;
+ if (null === e2)
+ return new Date(NaN);
+ if (O.u(e2))
+ return new Date();
+ if (e2 instanceof Date)
+ return new Date(e2);
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
+ var r2 = e2.match($);
+ if (r2) {
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
+ }
+ }
+ return new Date(e2);
+ }(t2), this.$x = t2.x || {}, this.init();
+ }, m2.init = function() {
+ var t2 = this.$d;
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
+ }, m2.$utils = function() {
+ return O;
+ }, m2.isValid = function() {
+ return !(this.$d.toString() === l);
+ }, m2.isSame = function(t2, e2) {
+ var n2 = w(t2);
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
+ }, m2.isAfter = function(t2, e2) {
+ return w(t2) < this.startOf(e2);
+ }, m2.isBefore = function(t2, e2) {
+ return this.endOf(e2) < w(t2);
+ }, m2.$g = function(t2, e2, n2) {
+ return O.u(t2) ? this[e2] : this.set(n2, t2);
+ }, m2.unix = function() {
+ return Math.floor(this.valueOf() / 1e3);
+ }, m2.valueOf = function() {
+ return this.$d.getTime();
+ }, m2.startOf = function(t2, e2) {
+ var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), l2 = function(t3, e3) {
+ var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
+ return r2 ? i2 : i2.endOf(a);
+ }, $2 = function(t3, e3) {
+ return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
+ switch (h2) {
+ case c:
+ return r2 ? l2(1, 0) : l2(31, 11);
+ case f:
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
+ case o:
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
+ case a:
+ case d:
+ return $2(v2 + "Hours", 0);
+ case u:
+ return $2(v2 + "Minutes", 1);
+ case s:
+ return $2(v2 + "Seconds", 2);
+ case i:
+ return $2(v2 + "Milliseconds", 3);
+ default:
+ return this.clone();
+ }
+ }, m2.endOf = function(t2) {
+ return this.startOf(t2, false);
+ }, m2.$set = function(t2, e2) {
+ var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
+ if (o2 === f || o2 === c) {
+ var y2 = this.clone().set(d, 1);
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
+ } else
+ l2 && this.$d[l2]($2);
+ return this.init(), this;
+ }, m2.set = function(t2, e2) {
+ return this.clone().$set(t2, e2);
+ }, m2.get = function(t2) {
+ return this[O.p(t2)]();
+ }, m2.add = function(r2, h2) {
+ var d2, l2 = this;
+ r2 = Number(r2);
+ var $2 = O.p(h2), y2 = function(t2) {
+ var e2 = w(l2);
+ return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
+ };
+ if ($2 === f)
+ return this.set(f, this.$M + r2);
+ if ($2 === c)
+ return this.set(c, this.$y + r2);
+ if ($2 === a)
+ return y2(1);
+ if ($2 === o)
+ return y2(7);
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
+ return O.w(m3, this);
+ }, m2.subtract = function(t2, e2) {
+ return this.add(-1 * t2, e2);
+ }, m2.format = function(t2) {
+ var e2 = this, n2 = this.$locale();
+ if (!this.isValid())
+ return n2.invalidDate || l;
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
+ }, c2 = function(t3) {
+ return O.s(s2 % 12 || 12, t3, "0");
+ }, d2 = n2.meridiem || function(t3, e3, n3) {
+ var r3 = t3 < 12 ? "AM" : "PM";
+ return n3 ? r3.toLowerCase() : r3;
+ }, $2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
+ return r2.replace(y, function(t3, e3) {
+ return e3 || $2[t3] || i2.replace(":", "");
+ });
+ }, m2.utcOffset = function() {
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
+ }, m2.diff = function(r2, d2, l2) {
+ var $2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, v2 = this - M3, g2 = O.m(this, M3);
+ return g2 = ($2 = {}, $2[c] = g2 / 12, $2[f] = g2, $2[h] = g2 / 3, $2[o] = (v2 - m3) / 6048e5, $2[a] = (v2 - m3) / 864e5, $2[u] = v2 / n, $2[s] = v2 / e, $2[i] = v2 / t, $2)[y2] || v2, l2 ? g2 : O.a(g2);
+ }, m2.daysInMonth = function() {
+ return this.endOf(f).$D;
+ }, m2.$locale = function() {
+ return D[this.$L];
+ }, m2.locale = function(t2, e2) {
+ if (!t2)
+ return this.$L;
+ var n2 = this.clone(), r2 = S(t2, e2, true);
+ return r2 && (n2.$L = r2), n2;
+ }, m2.clone = function() {
+ return O.w(this.$d, this);
+ }, m2.toDate = function() {
+ return new Date(this.valueOf());
+ }, m2.toJSON = function() {
+ return this.isValid() ? this.toISOString() : null;
+ }, m2.toISOString = function() {
+ return this.$d.toISOString();
+ }, m2.toString = function() {
+ return this.$d.toUTCString();
+ }, M2;
+ }(), T = _.prototype;
+ return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
+ T[t2[1]] = function(e2) {
+ return this.$g(e2, t2[0], t2[1]);
+ };
+ }), w.extend = function(t2, e2) {
+ return t2.$i || (t2(e2, _, w), t2.$i = true), w;
+ }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
+ return w(1e3 * t2);
+ }, w.en = D[g], w.Ls = D, w.p = {}, w;
+ });
+ }
+});
+export default require_dayjs_min();
+//# sourceMappingURL=dayjs.js.map
diff --git a/uni_modules/wu-ui-tools/libs/util/route.js b/uni_modules/wu-ui-tools/libs/util/route.js
new file mode 100644
index 0000000..b362b0e
--- /dev/null
+++ b/uni_modules/wu-ui-tools/libs/util/route.js
@@ -0,0 +1,124 @@
+/**
+ * 路由跳转方法,该方法相对于直接使用uni.xxx的好处是使用更加简单快捷
+ * 并且带有路由拦截功能
+ */
+import { queryParams, deepMerge,page } from '@/uni_modules/wu-ui-tools/libs/function/index.js'
+class Router {
+ constructor() {
+ // 原始属性定义
+ this.config = {
+ type: 'navigateTo',
+ url: '',
+ delta: 1, // navigateBack页面后退时,回退的层数
+ params: {}, // 传递的参数
+ animationType: 'pop-in', // 窗口动画,只在APP有效
+ animationDuration: 300, // 窗口动画持续时间,单位毫秒,只在APP有效
+ intercept: false // 是否需要拦截
+ }
+ // 因为route方法是需要对外赋值给另外的对象使用,同时route内部有使用this,会导致route失去上下文
+ // 这里在构造函数中进行this绑定
+ this.route = this.route.bind(this)
+ }
+
+ // 判断url前面是否有"/",如果没有则加上,否则无法跳转
+ addRootPath(url) {
+ return url[0] === '/' ? url : `/${url}`
+ }
+
+ // 整合路由参数
+ mixinParam(url, params) {
+ url = url && this.addRootPath(url)
+
+ // 使用正则匹配,主要依据是判断是否有"/","?","="等,如“/page/index/index?name=mary"
+ // 如果有url中有get参数,转换后无需带上"?"
+ let query = ''
+ if (/.*\/.*\?.*=.*/.test(url)) {
+ // object对象转为get类型的参数
+ query = queryParams(params, false)
+ // 因为已有get参数,所以后面拼接的参数需要带上"&"隔开
+ return url += `&${query}`
+ }
+ // 直接拼接参数,因为此处url中没有后面的query参数,也就没有"?/&"之类的符号
+ query = queryParams(params)
+ return url += query
+ }
+
+ // 对外的方法名称
+ async route(options = {}, params = {}) {
+ // 合并用户的配置和内部的默认配置
+ let mergeConfig = {}
+
+ if (typeof options === 'string') {
+ // 如果options为字符串,则为route(url, params)的形式
+ mergeConfig.url = this.mixinParam(options, params)
+ mergeConfig.type = 'navigateTo'
+ } else {
+ mergeConfig = deepMerge(this.config, options)
+ // 否则正常使用mergeConfig中的url和params进行拼接
+ mergeConfig.url = this.mixinParam(options.url, options.params)
+ }
+
+ // 如果本次跳转的路径和本页面路径一致,不执行跳转,防止用户快速点击跳转按钮,造成多次跳转同一个页面的问题
+ if (mergeConfig.url === page()) return
+
+ if (params.intercept) {
+ this.config.intercept = params.intercept
+ }
+ // params参数也带给拦截器
+ mergeConfig.params = params
+ // 合并内外部参数
+ mergeConfig = deepMerge(this.config, mergeConfig)
+ // 判断用户是否定义了拦截器
+ if (typeof routeIntercept === 'function') {
+ // 定一个promise,根据用户执行resolve(true)或者resolve(false)来决定是否进行路由跳转
+ const isNext = await new Promise((resolve, reject) => {
+ routeIntercept(mergeConfig, resolve)
+ })
+ // 如果isNext为true,则执行路由跳转
+ isNext && this.openPage(mergeConfig)
+ } else {
+ this.openPage(mergeConfig)
+ }
+ }
+
+ // 执行路由跳转
+ openPage(config) {
+ // 解构参数
+ const {
+ url,
+ type,
+ delta,
+ animationType,
+ animationDuration
+ } = config
+ if (config.type == 'navigateTo' || config.type == 'to') {
+ uni.navigateTo({
+ url,
+ animationType,
+ animationDuration
+ })
+ }
+ if (config.type == 'redirectTo' || config.type == 'redirect') {
+ uni.redirectTo({
+ url
+ })
+ }
+ if (config.type == 'switchTab' || config.type == 'tab') {
+ uni.switchTab({
+ url
+ })
+ }
+ if (config.type == 'reLaunch' || config.type == 'launch') {
+ uni.reLaunch({
+ url
+ })
+ }
+ if (config.type == 'navigateBack' || config.type == 'back') {
+ uni.navigateBack({
+ delta
+ })
+ }
+ }
+}
+
+export default (new Router()).route
diff --git a/uni_modules/wu-ui-tools/package.json b/uni_modules/wu-ui-tools/package.json
new file mode 100644
index 0000000..82b906b
--- /dev/null
+++ b/uni_modules/wu-ui-tools/package.json
@@ -0,0 +1,86 @@
+{
+ "id": "wu-ui-tools",
+ "displayName": "wu-ui-tools 工具库 全面兼容小程序、nvue、vue2、vue3",
+ "version": "1.1.0",
+ "description": "wu-ui-tools,集成工具库,强大的Http请求封装,清晰的文档说明,开箱即用。方便使用,可以全局使用",
+ "keywords": [
+ "wu-ui-tools",
+ "wu-ui",
+ "工具库",
+ "多端全兼容"
+ ],
+ "dependencies": {
+ "color": "^4.2.3"
+ },
+ "repository": "",
+ "engines": {
+ },
+ "dcloudext": {
+ "type": "component-vue",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "无"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-vue": "y",
+ "app-nvue": "y"
+ },
+ "H5-mobile": {
+ "Safari": "y",
+ "Android Browser": "y",
+ "微信浏览器(Android)": "y",
+ "QQ浏览器(Android)": "y"
+ },
+ "H5-pc": {
+ "Chrome": "y",
+ "IE": "y",
+ "Edge": "y",
+ "Firefox": "y",
+ "Safari": "y"
+ },
+ "小程序": {
+ "微信": "y",
+ "阿里": "y",
+ "百度": "y",
+ "字节跳动": "y",
+ "QQ": "y",
+ "钉钉": "y",
+ "快手": "y",
+ "飞书": "y",
+ "京东": "y"
+ },
+ "快应用": {
+ "华为": "y",
+ "联盟": "y"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/wu-ui-tools/readme.md b/uni_modules/wu-ui-tools/readme.md
new file mode 100644
index 0000000..7b6518c
--- /dev/null
+++ b/uni_modules/wu-ui-tools/readme.md
@@ -0,0 +1,18 @@
+## wu-ui-tools 工具集
+
+> **组件名:wu-ui-tools**
+
+wu-ui 工具集成,包括网络Http请求、便捷工具、节流防抖、对象操作、时间格式化、路由跳转、全局唯一标识符、规则校验等等。
+
+需要在自己的项目中使用请参考[扩展配置](https://wu.geeks.ink/zh-CN/components/extendedConfiguration.html)。
+
+## 查看文档
+
+## [完整示例项目下载 | 关注更多组件](https://ext.dcloud.net.cn/plugin?name=wu--ui)
+(请勿下载插件zip)
+
+
+
+
+
+**如使用过程中有任何问题,或者您对wu-ui有一些好的建议,欢迎加入 [wu-ui 交流群](https://wu.geeks.ink/zh-CN/components/qqFeedBack.html)**
diff --git a/uni_modules/wu-ui-tools/theme.scss b/uni_modules/wu-ui-tools/theme.scss
new file mode 100644
index 0000000..3d292c1
--- /dev/null
+++ b/uni_modules/wu-ui-tools/theme.scss
@@ -0,0 +1,43 @@
+// 此文件为wuUI的主题变量,这些变量目前只能通过uni.scss引入才有效,另外由于
+// uni.scss中引入的样式会同时混入到全局样式文件和单独每一个页面的样式中,造成微信程序包太大,
+// 故uni.scss只建议放scss变量名相关样式,其他的样式可以通过main.js或者App.vue引入
+
+$wu-main-color: #303133;
+$wu-content-color: #606266;
+$wu-tips-color: #909193;
+$wu-light-color: #c0c4cc;
+$wu-border-color: #dadbde;
+$wu-bg-color: #f3f4f6;
+$wu-disabled-color: #c8c9cc;
+
+$wu-primary: #3c9cff;
+$wu-primary-dark: #398ade;
+$wu-primary-disabled: #9acafc;
+$wu-primary-light: #ecf5ff;
+
+$wu-warning: #f9ae3d;
+$wu-warning-dark: #f1a532;
+$wu-warning-disabled: #f9d39b;
+$wu-warning-light: #fdf6ec;
+
+$wu-success: #5ac725;
+$wu-success-dark: #53c21d;
+$wu-success-disabled: #a9e08f;
+$wu-success-light: #f5fff0;
+
+$wu-error: #f56c6c;
+$wu-error-dark: #e45656;
+$wu-error-disabled: #f7b2b2;
+$wu-error-light: #fef0f0;
+
+$wu-info: #909399;
+$wu-info-dark: #767a82;
+$wu-info-disabled: #c4c6c9;
+$wu-info-light: #f4f4f5;
+
+@mixin flex($direction: row) {
+ /* #ifndef APP-NVUE */
+ display: flex;
+ /* #endif */
+ flex-direction: $direction;
+}
\ No newline at end of file
diff --git a/utils/dateTime.js b/utils/dateTime.js
index 9095266..f614bbe 100644
--- a/utils/dateTime.js
+++ b/utils/dateTime.js
@@ -52,8 +52,67 @@ function getDateAfterDays(date, days) {
return newDate;
}
+function getDateAfterMonths(date, months) {
+ const newDate = new Date(date);
+ const originalDate = date.getDate();
+
+ // 保存原始年月日
+ const originalYear = date.getFullYear();
+ const originalMonth = date.getMonth();
+
+ // 计算目标年月
+ const totalMonths = originalMonth + months;
+ const expectedYear = originalYear + Math.floor(totalMonths / 12);
+ const expectedMonth = totalMonths % 12;
+
+ // 尝试设置新月份
+ newDate.setMonth(totalMonths);
+
+ // 处理月末边界情况
+ if (
+ newDate.getFullYear() !== expectedYear ||
+ newDate.getMonth() !== expectedMonth
+ ) {
+ // 当设置月份失败时(如1月31日设置到2月)
+ // 设置为目标月份的最后一天
+ newDate.setFullYear(expectedYear, expectedMonth + 1, 0);
+ } else if (newDate.getDate() !== originalDate) {
+ // 当日期自动变化时(如1月30日设置到2月)
+ // 同样设置为目标月份的最后一天
+ newDate.setDate(0);
+ }
+
+ return newDate;
+}
+
+
+//计算当前日期占全年的进度数据
+// 示例用法
+// console.log(getYearProgress()); // 输出如 "35.42%"
+function getYearProgress() {
+ const now = new Date(); // 当前时间
+ const year = now.getFullYear();
+
+ // 关键时间点
+ const yearStart = new Date(year, 0, 1); // 当年1月1日
+ const nextYearStart = new Date(year + 1, 0, 1); // 下一年1月1日
+
+ // 计算时间差(毫秒)
+ const totalMs = nextYearStart - yearStart; // 全年总时长
+ const passedMs = now - yearStart; // 已过时长
+
+ // 计算百分比(保留2位小数)
+ const progress = ((passedMs / totalMs) * 100).toFixed(2);
+
+ return parseFloat(progress);
+}
+
+
+
export {
formatDate,
getDateAfterDays,
- getDaysDifference
+ getDaysDifference,
+ getDateAfterMonths,
+ getYearProgress
}
\ No newline at end of file