From e659867fb59ad88f121d446e56df53389d88960d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 03 四月 2023 12:09:35 +0800
Subject: [PATCH] 2023-04-03

---
 src/tabviews/custom/components/timeline/normal-timeline/index.jsx |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
index 463c865..1905369 100644
--- a/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
+++ b/src/tabviews/custom/components/timeline/normal-timeline/index.jsx
@@ -83,6 +83,15 @@
 
     card = _config.subcards[0]
 
+    if (_config.wrap.dotSign === 'adaptive') {
+      try {
+        let cl = Math.floor(document.body.clientWidth * _config.width / 24 / 320)
+        _config.wrap.dotSign = ['', 'size16', 'size18', 'size20', 'size22', 'size24', 'size24', 'size24', 'size24'][cl]
+      } catch(e) {
+        _config.wrap.dotSign = 'size20'
+      }
+    }
+
     this.setState({
       card,
       sync: _sync,
@@ -294,17 +303,26 @@
         Api.writeCacheConfig(config.uuid, result.data || '')
       }
 
+      let data = result.data.map((item, index) => {
+        item.key = index
+        item.$$uuid = item[config.setting.primaryKey] || ''
+        item.$$BID = BID || ''
+        item.$$BData = BData || ''
+        item.$Index = index + 1 + ''
+        return item
+      })
+
       this.setState({
-        data: result.data.map((item, index) => {
-          item.key = index
-          item.$$uuid = item[config.setting.primaryKey] || ''
-          item.$$BID = BID || ''
-          item.$$BData = BData || ''
-          item.$Index = index + 1 + ''
-          return item
-        }),
+        data: data,
         loading: false
       })
+
+      if (config.timer && config.clearField && result.data && result.data[0]) {
+        let vals = (config.clearValue || '').split(',')
+        if (vals.includes(result.data[0][config.clearField])) {
+          this.timer && this.timer.stop()
+        }
+      }
     } else {
       this.setState({
         loading: false
@@ -445,7 +463,7 @@
         </div>
         <div className="mk-timeline-item-head">
           <div className="mk-timeline-item-tail" style={linebg}></div>
-          <div className={'mk-dot ' + (dot ? 'mk-dot-icon' : '')} style={{background: color}}>
+          <div className={'mk-dot ' + (dot ? 'mk-dot-icon' : '')} style={{background: color, color: color}}>
             {dot}
           </div>
         </div>
@@ -454,7 +472,7 @@
       return (<div className="mk-time-line-item" key={data.$Index}>
         <div className="mk-timeline-item-head">
           <div className="mk-timeline-item-tail" style={linebg}></div>
-          <div className={'mk-dot ' + (dot ? 'mk-dot-icon' : '')} style={{background: color}}>
+          <div className={'mk-dot ' + (dot ? 'mk-dot-icon' : '')} style={{background: color, color: color}}>
             {dot}
           </div>
         </div>
@@ -470,6 +488,8 @@
   render() {
     const { config, loading, data, description } = this.state
 
+    if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null
+    
     return (
       <div className="normal-timeline-box" id={'anchor' + config.uuid} style={{...config.style}}>
         {loading ?
@@ -482,7 +502,7 @@
         {config.wrap.direction !== 'horizontal' && data && data.length > 0 ? <Timeline mode={config.wrap.mode} className={'card-row-list ' + (config.wrap.line || '')} style={{height: config.wrap.contentHeight}}>
           {data.map(item => this.getnodes(item))}
         </Timeline> : null}
-        {config.wrap.direction === 'horizontal' && data && data.length > 0 ? <div className={'mk-time-line-wrap card-row-list ' + (config.wrap.line || '')} style={{height: config.wrap.contentHeight}}>
+        {config.wrap.direction === 'horizontal' && data && data.length > 0 ? <div className={`mk-time-line-wrap card-row-list ${config.wrap.line || ''} ${config.wrap.iconSize || ''} ${config.wrap.dotSign || ''}`} style={{height: config.wrap.contentHeight}}>
           {data.map(item => this.getMknodes(item))}
         </div> : null}
         {data && data.length === 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}>

--
Gitblit v1.8.0