qymljy vor 2 Jahren
Ursprung
Commit
f456647029
51 geänderte Dateien mit 380 neuen und 1774 gelöschten Zeilen
  1. 11 0
      package-lock.json
  2. 1 0
      package.json
  3. 1 1
      src/HDrpManagement/BrandManage/index.vue
  4. 1 1
      src/HDrpManagement/BrandManage/modules/brand_del.vue
  5. 3 3
      src/HDrpManagement/ProductMag/index.vue
  6. 115 7
      src/HDrpManagement/ProductMag/modules/priceLevelSetting.vue
  7. 7 0
      src/HDrpManagement/contractManage/index.vue
  8. 1 1
      src/HDrpManagement/prodectFileData/modules/fileDel.vue
  9. 11 1
      src/router/HDrpManagement.js
  10. 229 0
      src/template/contractModel/DirectSelling.vue
  11. 0 12
      src/utils/Print/.babelrc
  12. 0 7
      src/utils/Print/.gitignore
  13. 0 11
      src/utils/Print/.npmignore
  14. 0 10
      src/utils/Print/.travis.yml
  15. 0 21
      src/utils/Print/LICENSE
  16. 0 98
      src/utils/Print/README.md
  17. 0 21
      src/utils/Print/bower.json
  18. 0 43
      src/utils/Print/karma.conf.js
  19. 0 60
      src/utils/Print/package.json
  20. 0 45
      src/utils/Print/src/index.d.ts
  21. 0 10
      src/utils/Print/src/index.js
  22. 0 29
      src/utils/Print/src/js/browser.js
  23. 0 103
      src/utils/Print/src/js/functions.js
  24. 0 65
      src/utils/Print/src/js/html.js
  25. 0 48
      src/utils/Print/src/js/image.js
  26. 0 168
      src/utils/Print/src/js/init.js
  27. 0 109
      src/utils/Print/src/js/json.js
  28. 0 62
      src/utils/Print/src/js/modal.js
  29. 0 57
      src/utils/Print/src/js/pdf.js
  30. 0 102
      src/utils/Print/src/js/print.js
  31. 0 15
      src/utils/Print/src/js/raw-html.js
  32. 0 14
      src/utils/Print/src/sass/index.scss
  33. 0 10
      src/utils/Print/src/sass/modules/_colors.scss
  34. 0 41
      src/utils/Print/src/sass/partials/_modal.scss
  35. 0 46
      src/utils/Print/src/sass/partials/_spinner.scss
  36. 0 0
      src/utils/Print/test/manual/base64.txt
  37. 0 308
      src/utils/Print/test/manual/index.html
  38. BIN
      src/utils/Print/test/manual/test-01.jpg
  39. BIN
      src/utils/Print/test/manual/test-02.jpg
  40. 0 11
      src/utils/Print/test/manual/test.css
  41. 0 23
      src/utils/Print/test/manual/test.pdf
  42. 0 40
      src/utils/Print/test/unit/browser.spec.js
  43. 0 31
      src/utils/Print/test/unit/functions.spec.js
  44. 0 7
      src/utils/Print/test/unit/html.spec.js
  45. 0 7
      src/utils/Print/test/unit/image.spec.js
  46. 0 7
      src/utils/Print/test/unit/init.spec.js
  47. 0 7
      src/utils/Print/test/unit/json.spec.js
  48. 0 11
      src/utils/Print/test/unit/modal.spec.js
  49. 0 7
      src/utils/Print/test/unit/pdf.spec.js
  50. 0 7
      src/utils/Print/test/unit/print.spec.js
  51. 0 87
      src/utils/Print/webpack.config.js

+ 11 - 0
package-lock.json

@@ -24,6 +24,7 @@
         "js-md5": "^0.7.3",
         "less-loader": "^11.1.0",
         "nprogress": "^0.2.0",
+        "print-js": "^1.6.0",
         "script-loader": "^0.7.2",
         "vue": "^2.6.14",
         "vue-countupjs": "^1.0.0",
@@ -11633,6 +11634,11 @@
         "renderkid": "^3.0.0"
       }
     },
+    "node_modules/print-js": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmmirror.com/print-js/-/print-js-1.6.0.tgz",
+      "integrity": "sha512-BfnOIzSKbqGRtO4o0rnj/K3681BSd2QUrsIZy/+WdCIugjIswjmx3lDEZpXB2ruGf9d4b3YNINri81+J0FsBWg=="
+    },
     "node_modules/prismjs": {
       "version": "1.28.0",
       "resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.28.0.tgz",
@@ -24796,6 +24802,11 @@
         "renderkid": "^3.0.0"
       }
     },
+    "print-js": {
+      "version": "1.6.0",
+      "resolved": "https://registry.npmmirror.com/print-js/-/print-js-1.6.0.tgz",
+      "integrity": "sha512-BfnOIzSKbqGRtO4o0rnj/K3681BSd2QUrsIZy/+WdCIugjIswjmx3lDEZpXB2ruGf9d4b3YNINri81+J0FsBWg=="
+    },
     "prismjs": {
       "version": "1.28.0",
       "resolved": "https://registry.npmmirror.com/prismjs/-/prismjs-1.28.0.tgz",

+ 1 - 0
package.json

@@ -25,6 +25,7 @@
     "js-md5": "^0.7.3",
     "less-loader": "^11.1.0",
     "nprogress": "^0.2.0",
+    "print-js": "^1.6.0",
     "script-loader": "^0.7.2",
     "vue": "^2.6.14",
     "vue-countupjs": "^1.0.0",

+ 1 - 1
src/HDrpManagement/BrandManage/index.vue

@@ -26,7 +26,7 @@
       </template>
       <template v-slot:tbOpreation="scope">
         <edit v-if="tool.checkAuth($route.name,'update')" :data="scope.data.data" @onSuccess="$refs.basicLayout.listData()"  :type="'text'"></edit>
-        <brand_del v-if="tool.checkAuth($route.name,'delete')" :data="scope.data.data" @onSuccess="$refs.basicLayout.listData()"  :type="'text'"></brand_del>
+        <brand_del v-if="tool.checkAuth($route.name,'onDelete')" :data="scope.data.data" @onSuccess="$refs.basicLayout.listData()"  :type="'text'"></brand_del>
       </template>
     </basicLayout>
   </div>

+ 1 - 1
src/HDrpManagement/BrandManage/modules/brand_del.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="inline-16">
     <el-popconfirm
-        title="确定删除当前选中账号吗?"
+        title="确定删除当前选中品牌吗?"
         @confirm="deleteRow()">
       <el-button slot="reference" size="small" type="text">删 除</el-button>
     </el-popconfirm>

+ 3 - 3
src/HDrpManagement/ProductMag/index.vue

@@ -18,9 +18,9 @@
       }"
       >
       <template #titleRight>
-        <to_examine class="inline-16" style="margin-left: 10px" :rowData="rowData" @examineSuccess="onSuccess"></to_examine>
-        <counter_examine class="inline-16" :rowData="rowData" @examineSuccess="onSuccess"></counter_examine>
-        <priceLevelSetting></priceLevelSetting>
+        <to_examine v-if="tool.checkAuth($route.name,'toExamine')" class="inline-16" style="margin-left: 10px" :rowData="rowData" @examineSuccess="onSuccess"></to_examine>
+        <counter_examine v-if="tool.checkAuth($route.name,'reverseReview')" class="inline-16" :rowData="rowData" @examineSuccess="onSuccess"></counter_examine>
+        <priceLevelSetting v-if="tool.checkAuth($route.name,'priceSet')"></priceLevelSetting>
       </template>
       <template #custom>
         <div class="mt-10">

+ 115 - 7
src/HDrpManagement/ProductMag/modules/priceLevelSetting.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <el-button size="small" type="primary" @click="drawer = true" >价格等级设置</el-button>
+    <el-button size="small" type="primary" @click="onShow" >价格等级设置</el-button>
     <el-drawer
         title="价格等级设置"
         :visible.sync="drawer"
@@ -10,12 +10,15 @@
         :show-close="false"
         >
       <div class="drawer__panel">
-<!--        <div style="margin-top: -10px;margin-bottom: 10px">
-          <el-button size="small" type="primary"  >添加</el-button>
-        </div>-->
+        <div style="margin-top: -10px;margin-bottom: 10px">
+          <el-button size="small" type="primary"  @click="addShow">添加</el-button>
+        </div>
         <tableLayout :layout="tablecols" :data="list" :custom="true" height="300px" >
           <template v-slot:customcol="scope">
-            <p >{{scope.column.data[scope.column.columnname]}}</p>
+            <p v-if="scope.column.columnname === 'discountrate'">
+              {{scope.column.data[scope.column.columnname] * 100}}
+            </p>
+            <p v-else>{{scope.column.data[scope.column.columnname]}}</p>
           </template>
           <template v-slot:opreation="scope">
             <el-popconfirm
@@ -31,6 +34,27 @@
         <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
       </div>
     </el-drawer>
+    <el-dialog title="添加价格等级" :visible.sync="dialogFormVisible" append-to-body width="500px" @close="dialogFormVisible = false;$refs.form.resetFields()">
+      <el-form :model="form" ref="form" :rules="rules">
+        <el-form-item label="商户等级:" :label-width="formLabelWidth" prop="grade">
+          <el-select v-model="form.grade" placeholder="请选择商户等级" style="width: 100%">
+            <el-option v-for="item in agentgrade" :key="item" :label="item" :value="item"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="价格等级:" :label-width="formLabelWidth" prop="pricegrade">
+          <el-select v-model="form.pricegrade" placeholder="请选择价格等级" style="width: 100%">
+            <el-option v-for="item in pricegrade" :key="item.index" :label="item.value" :value="item.value"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="折扣率:" :label-width="formLabelWidth" prop="discountrate">
+          <el-input v-model="form.discountrate" autocomplete="off" placeholder="请填写折扣" @change="discountrateChange"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button @click="dialogFormVisible = false;$refs.form.resetFields()">取 消</el-button>
+        <el-button type="primary" @click="add">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
@@ -48,13 +72,91 @@ export default {
         "id": 20220927143802,
         "content": {
         },
-      }
+      },
+      dialogFormVisible: false,
+      form: {
+        sa_itemprice_grademappingid: 0,
+        grade: '',//商户等级
+        pricegrade: '', //价格等级
+        discountrate: "" //折扣率,保留2位小数
+      },
+      rules:{
+        grade: [
+          { required: true, message: '请选择商户等级', trigger: 'change' },
+        ],
+        pricegrade: [
+          { required: true, message: '请选择价格等级', trigger: 'change' },
+        ],
+        discountrate: [
+          { required: true, message: '请输入折扣率', trigger: 'blur' }
+        ],
+      },
+      formLabelWidth: '120px',
+      pricegrade:[],
+      agentgrade:[]
     }
   },
   methods:{
+    onShow(){
+      this.drawer = true
+      this.listData()
+      this.queryPrice()
+    },
+    addShow(){
+      this.dialogFormVisible = true
+      this.queryPrice()
+    },
+    discountrateChange(){
+      if (this.form.discountrate < 0){
+        this.form.discountrate = 0
+      }else if(this.form.discountrate > 100){
+        this.form.discountrate = 100
+      }
+    },
+    add(){
+      this.$refs.form.validate(async(valid)=>{
+        if (!valid) return false
+        this.form.discountrate = (this.form.discountrate /100).toFixed(2)
+        const res = await this.$api.requested({
+          "id": 20220927143602,
+          "content": this.form,
+        })
+        this.tool.showMessage(res,()=>{
+          this.dialogFormVisible = false
+          this.$refs.form.resetFields()
+          this.listData()
+        })
+      })
+    },
     async listData(){
       const res = await this.$api.requested(this.param)
       this.list = res.data
+      console.log(this.list)
+      this.queryAgentGrade()
+    },
+    queryAgentGrade(){
+      this.$store.dispatch('optiontypeselect','agentgrade').then(res=>{
+        var t = 0
+        this.agentgrade = []
+        res.data.forEach((e,index)=>{
+          console.log(index)
+          var flag = 0
+          for (var i=0;i<this.list.length;i++){
+            if (this.list[i].grade == e.value ){
+              flag = 1
+              break
+            }else {
+              flag = 0
+            }
+          }
+          if (flag === 0){
+            this.agentgrade[t] = e.value
+            console.log(this.agentgrade[t])
+            t = t + 1
+          }
+        })
+        console.log(this.agentgrade)
+      })
     },
     async onDel(id){
       const res = await this.$api.requested({
@@ -66,10 +168,16 @@ export default {
       this.tool.showMessage(res,()=>{
         this.listData()
       })
+    },
+    queryPrice(){
+      this.$store.dispatch('optiontypeselect','pricegrade').then(res=>{
+        this.pricegrade = res.data
+        console.log(res.data,"pricegrade")
+      })
     }
   },
   mounted() {
-    this.listData()
+
   },
   created() {
     this.tablecols = this.tool.tabelCol(this.$route.name)['priceLevelSettingTable'].tablecols

+ 7 - 0
src/HDrpManagement/contractManage/index.vue

@@ -14,6 +14,10 @@
       }"
       @listData="listdata"
       @listCreate="list">
+      <div slot="titleRight" style="display:flex;margin-left:10px">
+        <!-- <distribution class="inline-16" v-if="tool.checkAuth($route.name,'distributionAgent')" @onSuccess="$refs.basicLayout.listData()"></distribution> -->
+<!--        <el-button size="small" @click="$router.push('/directSelling')">打印</el-button>-->
+      </div>
       <template #custom>
         <div class="mt-10">
           <p class="search__label">范围:</p>
@@ -119,6 +123,7 @@
         <span v-if="!scope.data.column.data[[scope.data.column.columnname]] && scope.data.column.data[[scope.data.column.columnname]] !== 0">--</span>
       </template>
       <template v-slot:tbOpreation="scope">
+<!--        <el-button size="mini" @click="$router.push({path:'/directSelling',query:{id:scope.data.data.sa_contractid,sys_enterpriseid:scope.data.data.sys_enterpriseid}})" type="text" >打印</el-button>-->
       </template>
     </basicLayout>
   </div>
@@ -126,9 +131,11 @@
 
 <script>
 import { log } from '@antv/g2plot/lib/utils'
+
 export default {
   data () {
     return {
+      DirectSellingShow:false,
       options:[],
       dateSelect:'',
       areaList:[

+ 1 - 1
src/HDrpManagement/prodectFileData/modules/fileDel.vue

@@ -18,7 +18,7 @@ export default {
         "id": "20220926095903",
         "version":1,
         "content": {
-          "plm_technicalinfoid":this.data.plm_technicalinfoid
+          "plm_technicalinfoids":[this.data.plm_technicalinfoid]
         }
       })
       this.tool.showMessage(res, ()=> {

+ 11 - 1
src/router/HDrpManagement.js

@@ -1,4 +1,14 @@
 const HDrpManagement = [
+  {
+    path: '/directSelling',
+    name: 'directSelling',
+    meta: {
+      title: '直销合同',
+      ast_nav: true,
+      keeproute: true,
+    },
+    component: () => import('@/template/contractModel/DirectSelling')
+  },
   {
     path: '/logisticcom',
     name: 'logisticcom',
@@ -893,7 +903,7 @@ const HDrpManagement = [
         component: () => import(/* webpackChunkName: "about" */ '@/HDrpManagement/servePeople/modules/detail')
       },
     ]
-  }
+  },
   
 ];
 export default HDrpManagement;

+ 229 - 0
src/template/contractModel/DirectSelling.vue

@@ -0,0 +1,229 @@
+<template>
+  <div class="size-span">
+    <div class="normal-panel container">
+      <el-button size="small" @click="handlePrint(printData)">预览</el-button>
+    </div>
+    <div id="directSelling">
+      <div style="text-align: center;font-size: 24px">{{information.title}}</div>
+      <div class="normal-panel container">
+        <div>
+          <span class="font-bold font-bold-size">甲方(供方):</span>
+          <span>{{clauseData.parta.enterprisename}}</span>
+        </div>
+        <div>
+          <span class="font-bold font-bold-size">乙方(需方):</span>
+          <span>{{clauseData.partb.enterprisename}}</span>
+        </div>
+        <div>
+          <span class="font-bold font-bold-size">合同编号:</span>
+          <span>{{information.billno}}</span>
+        </div>
+        <div>
+          <span class="font-bold font-bold-size">签约地点:</span>
+          <span>{{clauseData.partb.address}}</span>
+        </div>
+        <div style="height: 20px">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;甲乙双方在平等,自愿的基础上就班尼戈Conex|Bänninger品牌的阀门购销事宜达成一致意见,现依据《中华人民共和国民法典》的有关规定,特签定本合同,以共同遵守。</div>
+      </div>
+      <div class="container">
+        <div>
+          <span class="font-bold-size font-bold">第一条</span>
+          <span class="font-bold-size title-margin" >基本要求:</span>
+        </div>
+        <div>
+          1.工程名称:{{information.projectname}}
+        </div>
+        <div>
+          2.工程地址:{{information.province +  information.city + information.county +information.address}}
+        </div>
+        <div>
+          <span>
+            3.收货人:{{information.name}}
+          </span>
+          <span style="margin-left: 40px">联系电话:{{information.phonenumber}}</span>
+        </div>
+        <div>
+          <el-row>
+            <el-col :span="1.5">
+              <div>
+                4.付款方式:
+              </div>
+            </el-col>
+            <el-col :span="10">
+              <div style="width: 200px">
+                <el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <div style="margin-top: 10px;margin-left: 10px">
+          <el-row>
+            <el-col :span="1.5">
+              <div>
+                4.1
+              </div>
+            </el-col>
+            <el-col :span="10">
+              <div style="width: 200px;margin-left: 10px">
+                <el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <div style="margin-top: 10px;margin-left: 10px">
+          <el-row>
+            <el-col :span="1.5">
+              <div>
+                4.2
+              </div>
+            </el-col>
+            <el-col :span="10">
+              <div style="width: 200px;margin-left: 10px">
+                <el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <div style="margin-top: 10px">
+          剩余货款后的3个工作日内安排发货。
+        </div>
+        <div>
+          <span class="font-bold-size font-bold">第二条</span>
+          <span class="font-bold-size title-margin" >货物的名称、规格、数量及供应货款金额:</span>
+        </div>
+        <div class="title-marginF">
+          1. 货物采购明细表:(见附件)
+        </div>
+        <div class="title-marginF">
+          2. 订单货款金额:人民币(大写)
+        </div>
+        <div style="margin-left: 190px">
+          (小写)(含13%增值税专用发票)
+        </div>
+        <div class="title-marginF">
+          3. 产品参数请对照“货物采购明细表”内的型号及备注,可查阅http://www.ibpchina.com相关样
+          册或使用说明书(定制或者产品升级,以双方确认的参数为准);
+        </div>
+        <div class="title-marginF">
+          <el-row>
+            <el-col :span="4.5">
+              <div>
+                4.未做特殊备注,压力等级均为
+              </div>
+            </el-col>
+            <el-col :span="10">
+              <div style="width: 200px;margin-left: 10px">
+                <el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
+              </div>
+            </el-col>
+          </el-row>
+        </div>
+        <div>
+          <span class="font-bold-size font-bold">第三条</span>
+          <span class="font-bold-size title-margin" >甲方对质量负责的条件及期限:产品出厂之日起24个月。</span>
+        </div>
+        <div>
+          <span class="font-bold-size font-bold">第四条</span>
+          <span class="font-bold-size title-margin" >验收标准、方法及期限:按国家标准验收,水压试验;乙方受领货物后,应立即对货物的数量、型号、规格等进行验收;数量、型号、规格等存在差异的,乙方应在收到货物后七(7)日内提出,否则视同乙方已验收货物且对数量、型号、规格等无异议。</span>
+        </div>
+        <div>
+          <span class="font-bold-size title-margin" >
+            <el-row>
+            <el-col :span="4.5">
+             <span class="font-bold-size font-bold">第五条</span>
+            </el-col>
+            <el-col :span="4.5">
+             <span class="font-bold-size title-margin">运输要求及费用负担: 常规汽车物流运输方式,运输费用等由</span>
+            </el-col>
+            <el-col :span="3.5">
+              <div style="width: 200px;margin-left: 10px">
+                <el-input v-model="input" placeholder="请输入内容" size="mini"></el-input>
+              </div>
+            </el-col>
+              <el-col :span="4.5">
+             <span class="font-bold-size ">承担。(运输要求及费用负担承担方)</span>
+            </el-col>
+          </el-row>
+          </span>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import printJS from "print-js";
+export default {
+  name: "DirectSelling",
+  data(){
+    return {
+      information:'',
+      clauseData:'',
+      input:'',
+      printData: {
+        printable: 'directSelling',
+        ignore: ['no-print']
+      }
+    }
+  },
+  methods:{
+    async queryData(){
+      const res = await this.$api.requested({
+        "id": 20221121195102,
+        "content": {
+          "sa_contractid": this.$route.query.id
+        },
+      })
+      console.log(res,"合同详情")
+      this.information = res.data
+    },
+    async queryClause(){
+      const res = await this.$api.requested({
+        "id": 20230117112102,
+        "content": {
+          "sa_contractid": this.$route.query.id,
+        "sys_enterpriseid":this.$route.query.sys_enterpriseid//选择的企业
+        }
+      })
+      this.clauseData = res.data
+      console.log(this.clauseData,'合同条款')
+    },
+    handlePrint(params) {
+     /* printJS({printable:params.printable, type:'html', showModal:true})*/
+      printJS({
+        printable: params.printable, // 'printFrom', // 标签元素id
+        type: params.type || 'html',
+        header: params.header, // '表单',
+        targetStyles: ['*'],
+        style: '@page {margin:0 10mm};', // 可选-打印时去掉眉页眉尾
+        ignoreElements: params.ignore || [], // ['no-print']
+        properties: params.properties || null
+      })
+    }
+  },
+  mounted() {
+
+  },
+  created() {
+    this.queryData()
+    this.queryClause()
+  }
+}
+</script>
+
+<style scoped>
+  .font-bold {
+    font-weight: bold;
+  }
+  .font-bold-size{
+    font-size: 14px !important;
+  }
+  .title-margin{
+    margin-left: 10px;
+  }
+  .title-marginF{
+     margin-left: 45px;
+   }
+  .size-span {
+    font-size: 14px;
+  }
+</style>

+ 0 - 12
src/utils/Print/.babelrc

@@ -1,12 +0,0 @@
-{
-    "presets": [
-        [
-            "@babel/preset-env",
-            {
-                "targets": {
-                    "ie": "8"
-                }
-            }
-        ]
-    ]
-}

+ 0 - 7
src/utils/Print/.gitignore

@@ -1,7 +0,0 @@
-.idea/
-node_modules/
-dist/
-yarn.lock
-coverage/
-.vscode
-package-lock.json

+ 0 - 11
src/utils/Print/.npmignore

@@ -1,11 +0,0 @@
-.idea/
-.gitignore
-.travis.yml
-test/
-bower.json
-webpack.config.js
-karma.conf.js
-yarn.lock
-coverage/
-.vscode
-package-lock.json

+ 0 - 10
src/utils/Print/.travis.yml

@@ -1,10 +0,0 @@
-language: node_js
-node_js:
-  - 8
-  - 10
-branches:
-  only:
-    - master
-sudo: required
-after_success:
-  - npm run coveralls

+ 0 - 21
src/utils/Print/LICENSE

@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016-present, Rodrigo Vieira (@crabbly)
-
-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.

+ 0 - 98
src/utils/Print/README.md

@@ -1,98 +0,0 @@
-# Print.js
-
-[![Build Status](https://travis-ci.org/crabbly/Print.js.svg?branch=master)](https://travis-ci.org/crabbly/Print.js)
-[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](LICENSE)
-[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](http://standardjs.com/)
-[![npm](https://img.shields.io/npm/v/print-js.svg)](https://www.npmjs.com/package/print-js)
-
-A tiny javascript library to help printing from the web.
-
-> For documentation and examples please visit: [printjs.crabbly.com](http://printjs.crabbly.com)
-
-## Installation
-
-You can download the latest version of Print.js from the [GitHub releases](https://github.com/crabbly/Print.js/releases/latest) or use the [Print.js CDN](http://printjs.crabbly.com/#cdn) available on the documentation page.
-
-To install via npm:
-
-```bash
-npm install print-js --save
-```
-
-To install via yarn:
-
-```bash
-yarn add print-js
-```
-
-Import the library into your project:
-
-```js
-import printJS from 'print-js'
-```
-
-## Documentation
-
-You can find documentation at [printjs.crabbly.com](http://printjs.crabbly.com/#documentation).
-
-## Contributing to Print.js
-
-[![devDependencies Status](https://david-dm.org/crabbly/print.js/dev-status.svg)](https://david-dm.org/crabbly/print.js?type=dev)
-[![dependencies Status](https://david-dm.org/crabbly/print.js/status.svg)](https://david-dm.org/crabbly/print.js)
-
-Contributions to Print.js are greatly welcomed and encouraged.
-
-##### Using issues
-
-The [issue tracker](https://github.com/crabbly/Print.js/issues) is the preferred channel for reporting bugs, requesting new features and submitting pull requests.
-
-Keep in mind that we would like to keep this a lightweight library.
-
-Please do not use the issues channel for support requests. For help using Print.js, please ask questions on Stack Overflow and use the tag `printjs`.
-
-##### Reporting bugs
-
-Well structured, detailed bug reports are hugely valuable for the project.
-
- - Check the issue search to see if it has already been reported
- - Isolate the problem to a simple test case
- - Add a codepen, fiddle, codesandbox or similar online example replicating the issue
-
-Please provide any additional details associated with the bug.
-
-##### Pull requests
-
-Clear, concise pull requests are excellent at continuing the project's community driven growth.  
-
-Please make your commits in logical sections with clear commit messages.  
-
-##### Setting up a dev environment
-
-```bash
-npm install
-npm run watch
-```
-
-##### Tests
-
-The library is written following the [Javascript Standard](https://standardjs.com) code style. When running tests, we will also test for any style issues or warnings.
-
-Automated tests are written using the [Jasmine](https://jasmine.github.io) framework and [Karma](https://karma-runner.github.io) runner.
-
-To run the automated tests:
-
-```bash
-npm run test
-```
-
-To manually test the library features:
-
-```bash
-npm start
-```
-
-This will serve `test\manual\test.html` and open `http://localhost:8080/test/manual` in your default browser.
-
-## License
-
-Print.js is available under the [MIT license](https://github.com/crabbly/Print.js/blob/master/LICENSE).

+ 0 - 21
src/utils/Print/bower.json

@@ -1,21 +0,0 @@
-{
-  "name": "print-js",
-  "description": "A tiny javascript library to help printing from the web.",
-  "main": "dist/print.js",
-  "authors": [
-    "Rodrigo Vieira <rodrigo@crabbly.com>"
-  ],
-  "license": "MIT",
-  "keywords": [
-    "print.js",
-    "printjs",
-    "print-js"
-  ],
-  "homepage": "https://github.com/crabbly/Print.js",
-  "ignore": [
-    "**/.*",
-    "node_modules",
-    "bower_components",
-    "test"
-  ]
-}

+ 0 - 43
src/utils/Print/karma.conf.js

@@ -1,43 +0,0 @@
-// const path = require('path')
-
-module.exports = function (config) {
-  config.set({
-    frameworks: ['jasmine'],
-    files: [
-      'test/**/*.spec.js'
-    ],
-    exclude: [],
-    preprocessors: {
-      'test/**/*.js': ['webpack', 'sourcemap', 'coverage']
-    },
-    reporters: ['progress', 'coverage'],
-    coverageReporter: {
-      dir: 'coverage/',
-      type: 'lcov',
-      subdir: '.',
-      includeAllSources: true,
-      fixWebpackSourcePaths: true,
-      combineBrowserReports: true
-    },
-    port: 9876,
-    colors: true,
-    logLevel: config.LOG_ERROR,
-    autoWatch: false,
-    browsers: ['ChromeHeadless'],
-    singleRun: true,
-    concurrency: 1,
-    webpack: {
-      mode: 'development'
-      // TODO: Configure istanbul to interpret how webpack bundles files
-      // module: {
-      //   rules: [
-      //     {
-      //       test: /\.js$/,
-      //       use: { loader: 'istanbul-instrumenter-loader' },
-      //       include: path.resolve('src/js/index.js')
-      //     }
-      //   ]
-      // }
-    }
-  })
-}

+ 0 - 60
src/utils/Print/package.json

@@ -1,60 +0,0 @@
-{
-  "name": "print-js",
-  "homepage": "http://printjs.crabbly.com",
-  "description": "A tiny javascript library to help printing from the web.",
-  "version": "1.5.0",
-  "main": "dist/print.js",
-  "types": "src/index.d.ts",
-  "repository": "https://github.com/crabbly/Print.js",
-  "license": "MIT",
-  "devDependencies": {
-    "@babel/core": "7.11.6",
-    "@babel/preset-env": "7.11.5",
-    "babel-loader": "8.1.0",
-    "coveralls": "3.1.0",
-    "css-loader": "4.2.2",
-    "istanbul-instrumenter-loader": "3.0.1",
-    "jasmine-core": "3.6.0",
-    "karma": "5.2.1",
-    "karma-chrome-launcher": "3.1.0",
-    "karma-coverage": "2.0.3",
-    "karma-jasmine": "4.0.1",
-    "karma-phantomjs-launcher": "1.0.4",
-    "karma-sourcemap-loader": "0.3.8",
-    "karma-webpack": "4.0.2",
-    "mini-css-extract-plugin": "0.11.0",
-    "node-sass": "4.14.1",
-    "optimize-css-assets-webpack-plugin": "5.0.4",
-    "sass-loader": "10.0.2",
-    "standard": "14.3.4",
-    "terser-webpack-plugin": "4.1.0",
-    "webpack": "4.44.1",
-    "webpack-cli": "3.3.12",
-    "webpack-dev-server": "3.11.0"
-  },
-  "scripts": {
-    "test": "standard && karma start",
-    "dev": "webpack --mode development --progress --hide-modules --devtool source-map",
-    "watch": "webpack --mode development --watch --progress --hide-modules",
-    "production": "webpack --mode production --progress --hide-modules",
-    "coverage": "open coverage/lcov-report/index.html",
-    "coveralls": "cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
-		"start": "webpack-dev-server --public http://localhost:8080/test/manual --open",
-		"standard:fix": "standard --fix"
-  },
-  "author": "Rodrigo Vieira <rodrigo@crabbly.com>",
-  "standard": {
-    "ignore": [
-      "/dist/print.js"
-    ],
-    "env": {
-      "browser": true,
-      "jasmine": true
-    }
-  },
-  "keywords": [
-    "printjs",
-    "print.js",
-    "print-js"
-  ]
-}

+ 0 - 45
src/utils/Print/src/index.d.ts

@@ -1,45 +0,0 @@
-declare function printJS(configuration: printJS.Configuration): void;
-declare function printJS(source: string, type?: printJS.PrintTypes): void;
-
-declare namespace printJS {
-  type PrintTypes = 'pdf' | 'html' | 'image' | 'json' | 'raw-html';
-
-  interface Configuration {
-    printable: any;
-    fallbackPrintable?: string;
-    type?: PrintTypes;
-    documentTitle?: string;
-    header?: any;
-    headerStyle?: string;
-    maxWidth?: number;
-    targetStyle?: string | string[];
-    targetStyles?: string | string[];
-    properties?: any;
-    gridHeaderStyle?: string;
-    gridStyle?: string;
-    showModal?: boolean;
-    onLoadingStart?: () => void;
-    onLoadingEnd?: () => void;
-    modalMessage?: string;
-    frameId?: string;
-    ignoreElements?: string | string[];
-    repeatTableHeader?: boolean;
-    css?: string | string[];
-    style?: string;
-    scanStyles?: boolean;
-    onError?: (error: any) => void;
-    onPrintDialogClose?: () => void;
-    onIncompatibleBrowser?: () => void;
-    base64?: boolean;
-
-    // Deprecated
-    onPdfOpen?: () => void;
-    font?: string;
-    font_size?: string;
-    honorMarginPadding?: boolean;
-    honorColor?: boolean;
-    imageStyle?: string;
-  }
-}
-
-export = printJS;

+ 0 - 10
src/utils/Print/src/index.js

@@ -1,10 +0,0 @@
-import './sass/index.scss'
-import print from './js/init'
-
-const printJS = print.init
-
-if (typeof window !== 'undefined') {
-  window.printJS = printJS
-}
-
-export default printJS

+ 0 - 29
src/utils/Print/src/js/browser.js

@@ -1,29 +0,0 @@
-const Browser = {
-  // Firefox 1.0+
-  isFirefox: () => {
-    return typeof InstallTrigger !== 'undefined'
-  },
-  // Internet Explorer 6-11
-  isIE: () => {
-    return navigator.userAgent.indexOf('MSIE') !== -1 || !!document.documentMode
-  },
-  // Edge 20+
-  isEdge: () => {
-    return !Browser.isIE() && !!window.StyleMedia
-  },
-  // Chrome 1+
-  isChrome: (context = window) => {
-    return !!context.chrome
-  },
-  // At least Safari 3+: "[object HTMLElementConstructor]"
-  isSafari: () => {
-    return Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 ||
-        navigator.userAgent.toLowerCase().indexOf('safari') !== -1
-  },
-  // IOS Chrome
-  isIOSChrome: () => {
-    return navigator.userAgent.toLowerCase().indexOf('crios') !== -1
-  }
-}
-
-export default Browser

+ 0 - 103
src/utils/Print/src/js/functions.js

@@ -1,103 +0,0 @@
-import Modal from './modal'
-import Browser from './browser'
-
-export function addWrapper (htmlData, params) {
-  const bodyStyle = 'font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;'
-  return '<div style="' + bodyStyle + '">' + htmlData + '</div>'
-}
-
-export function capitalizePrint (obj) {
-  return obj.charAt(0).toUpperCase() + obj.slice(1)
-}
-
-export function collectStyles (element, params) {
-  const win = document.defaultView || window
-
-  // String variable to hold styling for each element
-  let elementStyle = ''
-
-  // Loop over computed styles
-  const styles = win.getComputedStyle(element, '')
-
-  for (let key = 0; key < styles.length; key++) {
-    // Check if style should be processed
-    if (params.targetStyles.indexOf('*') !== -1 || params.targetStyle.indexOf(styles[key]) !== -1 || targetStylesMatch(params.targetStyles, styles[key])) {
-      if (styles.getPropertyValue(styles[key])) elementStyle += styles[key] + ':' + styles.getPropertyValue(styles[key]) + ';'
-    }
-  }
-
-  // Print friendly defaults (deprecated)
-  elementStyle += 'max-width: ' + params.maxWidth + 'px !important; font-size: ' + params.font_size + ' !important;'
-
-  return elementStyle
-}
-
-function targetStylesMatch (styles, value) {
-  for (let i = 0; i < styles.length; i++) {
-    if (typeof value === 'object' && value.indexOf(styles[i]) !== -1) return true
-  }
-  return false
-}
-
-export function addHeader (printElement, params) {
-  // Create the header container div
-  const headerContainer = document.createElement('div')
-
-  // Check if the header is text or raw html
-  if (isRawHTML(params.header)) {
-    headerContainer.innerHTML = params.header
-  } else {
-    // Create header element
-    const headerElement = document.createElement('h1')
-
-    // Create header text node
-    const headerNode = document.createTextNode(params.header)
-
-    // Build and style
-    headerElement.appendChild(headerNode)
-    headerElement.setAttribute('style', params.headerStyle)
-    headerContainer.appendChild(headerElement)
-  }
-
-  printElement.insertBefore(headerContainer, printElement.childNodes[0])
-}
-
-export function cleanUp (params) {
-  // If we are showing a feedback message to user, remove it
-  if (params.showModal) Modal.close()
-
-  // Check for a finished loading hook function
-  if (params.onLoadingEnd) params.onLoadingEnd()
-
-  // If preloading pdf files, clean blob url
-  if (params.showModal || params.onLoadingStart) window.URL.revokeObjectURL(params.printable)
-
-  // Run onPrintDialogClose callback
-  let event = 'mouseover'
-
-  if (Browser.isChrome() || Browser.isFirefox()) {
-    // Ps.: Firefox will require an extra click in the document to fire the focus event.
-    event = 'focus'
-  }
-
-  const handler = () => {
-    // Make sure the event only happens once.
-    window.removeEventListener(event, handler)
-
-    params.onPrintDialogClose()
-
-    // Remove iframe from the DOM
-    const iframe = document.getElementById(params.frameId)
-
-    if (iframe) {
-      iframe.remove()
-    }
-  }
-
-  window.addEventListener(event, handler)
-}
-
-export function isRawHTML (raw) {
-  const regexHtml = new RegExp('<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>')
-  return regexHtml.test(raw)
-}

+ 0 - 65
src/utils/Print/src/js/html.js

@@ -1,65 +0,0 @@
-import { collectStyles, addHeader } from './functions'
-import Print from './print'
-
-export default {
-  print: (params, printFrame) => {
-    // Get the DOM printable element
-    const printElement = document.getElementById(params.printable)
-
-    // Check if the element exists
-    if (!printElement) {
-      window.console.error('Invalid HTML element id: ' + params.printable)
-      return
-    }
-
-    // Clone the target element including its children (if available)
-    params.printableElement = cloneElement(printElement, params)
-
-    // Add header
-    if (params.header) {
-      addHeader(params.printableElement, params)
-    }
-
-    // Print html element contents
-    Print.send(params, printFrame)
-  }
-}
-
-function cloneElement (element, params) {
-  // Clone the main node (if not already inside the recursion process)
-  const clone = element.cloneNode()
-
-  // Loop over and process the children elements / nodes (including text nodes)
-  const childNodesArray = Array.prototype.slice.call(element.childNodes)
-  for (let i = 0; i < childNodesArray.length; i++) {
-    // Check if we are skiping the current element
-    if (params.ignoreElements.indexOf(childNodesArray[i].id) !== -1) {
-      continue
-    }
-
-    // Clone the child element
-    const clonedChild = cloneElement(childNodesArray[i], params)
-
-    // Attach the cloned child to the cloned parent node
-    clone.appendChild(clonedChild)
-  }
-
-  // Get all styling for print element (for nodes of type element only)
-  if (params.scanStyles && element.nodeType === 1) {
-    clone.setAttribute('style', collectStyles(element, params))
-  }
-
-  // Check if the element needs any state processing (copy user input data)
-  switch (element.tagName) {
-    case 'SELECT':
-      // Copy the current selection value to its clone
-      clone.value = element.value
-      break
-    case 'CANVAS':
-      // Copy the canvas content to its clone
-      clone.getContext('2d').drawImage(element, 0, 0)
-      break
-  }
-
-  return clone
-}

+ 0 - 48
src/utils/Print/src/js/image.js

@@ -1,48 +0,0 @@
-import { addHeader } from './functions'
-import Print from './print'
-import Browser from './browser'
-
-export default {
-  print: (params, printFrame) => {
-    // Check if we are printing one image or multiple images
-    if (params.printable.constructor !== Array) {
-      // Create array with one image
-      params.printable = [params.printable]
-    }
-
-    // Create printable element (container)
-    params.printableElement = document.createElement('div')
-
-    // Create all image elements and append them to the printable container
-    params.printable.forEach(src => {
-      // Create the image element
-      const img = document.createElement('img')
-      img.setAttribute('style', params.imageStyle)
-
-      // Set image src with the file url
-      img.src = src
-
-      // The following block is for Firefox, which for some reason requires the image's src to be fully qualified in
-      // order to print it
-      if (Browser.isFirefox()) {
-        const fullyQualifiedSrc = img.src
-        img.src = fullyQualifiedSrc
-      }
-
-      // Create the image wrapper
-      const imageWrapper = document.createElement('div')
-
-      // Append image to the wrapper element
-      imageWrapper.appendChild(img)
-
-      // Append wrapper to the printable element
-      params.printableElement.appendChild(imageWrapper)
-    })
-
-    // Check if we are adding a print header
-    if (params.header) addHeader(params.printableElement, params)
-
-    // Print image
-    Print.send(params, printFrame)
-  }
-}

+ 0 - 168
src/utils/Print/src/js/init.js

@@ -1,168 +0,0 @@
-'use strict'
-
-import Browser from './browser'
-import Modal from './modal'
-import Pdf from './pdf'
-import Html from './html'
-import RawHtml from './raw-html'
-import Image from './image'
-import Json from './json'
-
-const printTypes = ['pdf', 'html', 'image', 'json', 'raw-html']
-
-export default {
-  init () {
-    const params = {
-      printable: null,
-      fallbackPrintable: null,
-      type: 'pdf',
-      header: null,
-      headerStyle: 'font-weight: 300;',
-      maxWidth: 800,
-      properties: null,
-      gridHeaderStyle: 'font-weight: bold; padding: 5px; border: 1px solid #dddddd;',
-      gridStyle: 'border: 1px solid lightgray; margin-bottom: -1px;',
-      showModal: false,
-      onError: (error) => { throw error },
-      onLoadingStart: null,
-      onLoadingEnd: null,
-      onPrintDialogClose: () => {},
-      onIncompatibleBrowser: () => {},
-      modalMessage: 'Retrieving Document...',
-      frameId: 'printJS',
-      printableElement: null,
-      documentTitle: 'Document',
-      targetStyle: ['clear', 'display', 'width', 'min-width', 'height', 'min-height', 'max-height'],
-      targetStyles: ['border', 'box', 'break', 'text-decoration'],
-      ignoreElements: [],
-      repeatTableHeader: true,
-      css: null,
-      style: null,
-      scanStyles: true,
-      base64: false,
-
-      // Deprecated
-      onPdfOpen: null,
-      font: 'TimesNewRoman',
-      font_size: '12pt',
-      honorMarginPadding: true,
-      honorColor: false,
-      imageStyle: 'max-width: 100%;'
-    }
-
-    // Check if a printable document or object was supplied
-    const args = arguments[0]
-    if (args === undefined) {
-      throw new Error('printJS expects at least 1 attribute.')
-    }
-
-    // Process parameters
-    switch (typeof args) {
-      case 'string':
-        params.printable = encodeURI(args)
-        params.fallbackPrintable = params.printable
-        params.type = arguments[1] || params.type
-        break
-      case 'object':
-        params.printable = args.printable
-        params.fallbackPrintable = typeof args.fallbackPrintable !== 'undefined' ? args.fallbackPrintable : params.printable
-        params.fallbackPrintable = params.base64 ? `data:application/pdf;base64,${params.fallbackPrintable}` : params.fallbackPrintable
-        for (var k in params) {
-          if (k === 'printable' || k === 'fallbackPrintable') continue
-
-          params[k] = typeof args[k] !== 'undefined' ? args[k] : params[k]
-        }
-        break
-      default:
-        throw new Error('Unexpected argument type! Expected "string" or "object", got ' + typeof args)
-    }
-
-    // Validate printable
-    if (!params.printable) throw new Error('Missing printable information.')
-
-    // Validate type
-    if (!params.type || typeof params.type !== 'string' || printTypes.indexOf(params.type.toLowerCase()) === -1) {
-      throw new Error('Invalid print type. Available types are: pdf, html, image and json.')
-    }
-
-    // Check if we are showing a feedback message to the user (useful for large files)
-    if (params.showModal) Modal.show(params)
-
-    // Check for a print start hook function
-    if (params.onLoadingStart) params.onLoadingStart()
-
-    // To prevent duplication and issues, remove any used printFrame from the DOM
-    const usedFrame = document.getElementById(params.frameId)
-
-    if (usedFrame) usedFrame.parentNode.removeChild(usedFrame)
-
-    // Create a new iframe for the print job
-    const printFrame = document.createElement('iframe')
-
-    if (Browser.isFirefox()) {
-      // Set the iframe to be is visible on the page (guaranteed by fixed position) but hidden using opacity 0, because
-      // this works in Firefox. The height needs to be sufficient for some part of the document other than the PDF
-      // viewer's toolbar to be visible in the page
-      printFrame.setAttribute('style', 'width: 1px; height: 100px; position: fixed; left: 0; top: 0; opacity: 0; border-width: 0; margin: 0; padding: 0')
-    } else {
-      // Hide the iframe in other browsers
-      printFrame.setAttribute('style', 'visibility: hidden; height: 0; width: 0; position: absolute; border: 0')
-    }
-
-    // Set iframe element id
-    printFrame.setAttribute('id', params.frameId)
-
-    // For non pdf printing, pass an html document string to srcdoc (force onload callback)
-    if (params.type !== 'pdf') {
-      printFrame.srcdoc = '<html><head><title>' + params.documentTitle + '</title>'
-
-      // Attach css files
-      if (params.css) {
-        // Add support for single file
-        if (!Array.isArray(params.css)) params.css = [params.css]
-
-        // Create link tags for each css file
-        params.css.forEach(file => {
-          printFrame.srcdoc += '<link rel="stylesheet" href="' + file + '">'
-        })
-      }
-
-      printFrame.srcdoc += '</head><body></body></html>'
-    }
-
-    // Check printable type
-    switch (params.type) {
-      case 'pdf':
-        // Check browser support for pdf and if not supported we will just open the pdf file instead
-        if (Browser.isIE()) {
-          try {
-            console.info('Print.js doesn\'t support PDF printing in Internet Explorer.')
-            const win = window.open(params.fallbackPrintable, '_blank')
-            win.focus()
-            params.onIncompatibleBrowser()
-          } catch (error) {
-            params.onError(error)
-          } finally {
-            // Make sure there is no loading modal opened
-            if (params.showModal) Modal.close()
-            if (params.onLoadingEnd) params.onLoadingEnd()
-          }
-        } else {
-          Pdf.print(params, printFrame)
-        }
-        break
-      case 'image':
-        Image.print(params, printFrame)
-        break
-      case 'html':
-        Html.print(params, printFrame)
-        break
-      case 'raw-html':
-        RawHtml.print(params, printFrame)
-        break
-      case 'json':
-        Json.print(params, printFrame)
-        break
-    }
-  }
-}

+ 0 - 109
src/utils/Print/src/js/json.js

@@ -1,109 +0,0 @@
-import { capitalizePrint, addHeader } from './functions'
-import Print from './print'
-
-export default {
-  print: (params, printFrame) => {
-    // Check if we received proper data
-    if (typeof params.printable !== 'object') {
-      throw new Error('Invalid javascript data object (JSON).')
-    }
-
-    // Validate repeatTableHeader
-    if (typeof params.repeatTableHeader !== 'boolean') {
-      throw new Error('Invalid value for repeatTableHeader attribute (JSON).')
-    }
-
-    // Validate properties
-    if (!params.properties || !Array.isArray(params.properties)) {
-      throw new Error('Invalid properties array for your JSON data.')
-    }
-
-    // We will format the property objects to keep the JSON api compatible with older releases
-    params.properties = params.properties.map(property => {
-      return {
-        field: typeof property === 'object' ? property.field : property,
-        displayName: typeof property === 'object' ? property.displayName : property,
-        columnSize: typeof property === 'object' && property.columnSize ? property.columnSize + ';' : 100 / params.properties.length + '%;'
-      }
-    })
-
-    // Create a print container element
-    params.printableElement = document.createElement('div')
-
-    // Check if we are adding a print header
-    if (params.header) {
-      addHeader(params.printableElement, params)
-    }
-
-    // Build the printable html data
-    params.printableElement.innerHTML += jsonToHTML(params)
-
-    // Print the json data
-    Print.send(params, printFrame)
-  }
-}
-
-function jsonToHTML (params) {
-  // Get the row and column data
-  const data = params.printable
-  const properties = params.properties
-
-  // Create a html table
-  let htmlData = '<table style="border-collapse: collapse; width: 100%;">'
-
-  // Check if the header should be repeated
-  if (params.repeatTableHeader) {
-    htmlData += '<thead>'
-  }
-
-  // Add the table header row
-  htmlData += '<tr>'
-
-  // Add the table header columns
-  for (let a = 0; a < properties.length; a++) {
-    htmlData += '<th style="width:' + properties[a].columnSize + ';' + params.gridHeaderStyle + '">' + capitalizePrint(properties[a].displayName) + '</th>'
-  }
-
-  // Add the closing tag for the table header row
-  htmlData += '</tr>'
-
-  // If the table header is marked as repeated, add the closing tag
-  if (params.repeatTableHeader) {
-    htmlData += '</thead>'
-  }
-
-  // Create the table body
-  htmlData += '<tbody>'
-
-  // Add the table data rows
-  for (let i = 0; i < data.length; i++) {
-    // Add the row starting tag
-    htmlData += '<tr>'
-
-    // Print selected properties only
-    for (let n = 0; n < properties.length; n++) {
-      let stringData = data[i]
-
-      // Support nested objects
-      const property = properties[n].field.split('.')
-      if (property.length > 1) {
-        for (let p = 0; p < property.length; p++) {
-          stringData = stringData[property[p]]
-        }
-      } else {
-        stringData = stringData[properties[n].field]
-      }
-
-      // Add the row contents and styles
-      htmlData += '<td style="width:' + properties[n].columnSize + params.gridStyle + '">' + stringData + '</td>'
-    }
-
-    // Add the row closing tag
-    htmlData += '</tr>'
-  }
-
-  // Add the table and body closing tags
-  htmlData += '</tbody></table>'
-
-  return htmlData
-}

+ 0 - 62
src/utils/Print/src/js/modal.js

@@ -1,62 +0,0 @@
-const Modal = {
-  show (params) {
-    // Build modal
-    const modalStyle = 'font-family:sans-serif; ' +
-        'display:table; ' +
-        'text-align:center; ' +
-        'font-weight:300; ' +
-        'font-size:30px; ' +
-        'left:0; top:0;' +
-        'position:fixed; ' +
-        'z-index: 9990;' +
-        'color: #0460B5; ' +
-        'width: 100%; ' +
-        'height: 100%; ' +
-        'background-color:rgba(255,255,255,.9);' +
-        'transition: opacity .3s ease;'
-
-    // Create wrapper
-    const printModal = document.createElement('div')
-    printModal.setAttribute('style', modalStyle)
-    printModal.setAttribute('id', 'printJS-Modal')
-
-    // Create content div
-    const contentDiv = document.createElement('div')
-    contentDiv.setAttribute('style', 'display:table-cell; vertical-align:middle; padding-bottom:100px;')
-
-    // Add close button (requires print.css)
-    const closeButton = document.createElement('div')
-    closeButton.setAttribute('class', 'printClose')
-    closeButton.setAttribute('id', 'printClose')
-    contentDiv.appendChild(closeButton)
-
-    // Add spinner (requires print.css)
-    const spinner = document.createElement('span')
-    spinner.setAttribute('class', 'printSpinner')
-    contentDiv.appendChild(spinner)
-
-    // Add message
-    const messageNode = document.createTextNode(params.modalMessage)
-    contentDiv.appendChild(messageNode)
-
-    // Add contentDiv to printModal
-    printModal.appendChild(contentDiv)
-
-    // Append print modal element to document body
-    document.getElementsByTagName('body')[0].appendChild(printModal)
-
-    // Add event listener to close button
-    document.getElementById('printClose').addEventListener('click', function () {
-      Modal.close()
-    })
-  },
-  close () {
-    const printModal = document.getElementById('printJS-Modal')
-
-    if (printModal) {
-      printModal.parentNode.removeChild(printModal)
-    }
-  }
-}
-
-export default Modal

+ 0 - 57
src/utils/Print/src/js/pdf.js

@@ -1,57 +0,0 @@
-import Print from './print'
-import { cleanUp } from './functions'
-
-export default {
-  print: (params, printFrame) => {
-    // Check if we have base64 data
-    if (params.base64) {
-      const bytesArray = Uint8Array.from(atob(params.printable), c => c.charCodeAt(0))
-      createBlobAndPrint(params, printFrame, bytesArray)
-      return
-    }
-
-    // Format pdf url
-    params.printable = /^(blob|http|\/\/)/i.test(params.printable)
-      ? params.printable
-      : window.location.origin + (params.printable.charAt(0) !== '/' ? '/' + params.printable : params.printable)
-
-    // Get the file through a http request (Preload)
-    const req = new window.XMLHttpRequest()
-    req.responseType = 'arraybuffer'
-
-    req.addEventListener('error', () => {
-      cleanUp(params)
-      params.onError(req.statusText)
-
-      // Since we don't have a pdf document available, we will stop the print job
-    })
-
-    req.addEventListener('load', () => {
-      // Check for errors
-      if ([200, 201].indexOf(req.status) === -1) {
-        cleanUp(params)
-        params.onError(req.statusText)
-
-        // Since we don't have a pdf document available, we will stop the print job
-        return
-      }
-
-      // Print requested document
-      createBlobAndPrint(params, printFrame, req.response)
-    })
-
-    req.open('GET', params.printable, true)
-    req.send()
-  }
-}
-
-function createBlobAndPrint (params, printFrame, data) {
-  // Pass response or base64 data to a blob and create a local object url
-  let localPdf = new window.Blob([data], { type: 'application/pdf' })
-  localPdf = window.URL.createObjectURL(localPdf)
-
-  // Set iframe src with pdf document url
-  printFrame.setAttribute('src', localPdf)
-
-  Print.send(params, printFrame)
-}

+ 0 - 102
src/utils/Print/src/js/print.js

@@ -1,102 +0,0 @@
-import Browser from './browser'
-import { cleanUp } from './functions'
-
-const Print = {
-  send: (params, printFrame) => {
-    // Append iframe element to document body
-    document.getElementsByTagName('body')[0].appendChild(printFrame)
-
-    // Get iframe element
-    const iframeElement = document.getElementById(params.frameId)
-
-    // Wait for iframe to load all content
-    iframeElement.onload = () => {
-      if (params.type === 'pdf') {
-        // Add a delay for Firefox. In my tests, 1000ms was sufficient but 100ms was not
-        if (Browser.isFirefox()) {
-          setTimeout(() => performPrint(iframeElement, params), 1000)
-        } else {
-          performPrint(iframeElement, params)
-        }
-        return
-      }
-
-      // Get iframe element document
-      let printDocument = (iframeElement.contentWindow || iframeElement.contentDocument)
-      if (printDocument.document) printDocument = printDocument.document
-
-      // Append printable element to the iframe body
-      printDocument.body.appendChild(params.printableElement)
-
-      // Add custom style
-      if (params.type !== 'pdf' && params.style) {
-        // Create style element
-        const style = document.createElement('style')
-        style.innerHTML = params.style
-
-        // Append style element to iframe's head
-        printDocument.head.appendChild(style)
-      }
-
-      // If printing images, wait for them to load inside the iframe
-      const images = printDocument.getElementsByTagName('img')
-
-      if (images.length > 0) {
-        loadIframeImages(Array.from(images)).then(() => performPrint(iframeElement, params))
-      } else {
-        performPrint(iframeElement, params)
-      }
-    }
-  }
-}
-
-function performPrint (iframeElement, params) {
-  try {
-    iframeElement.focus()
-
-    // If Edge or IE, try catch with execCommand
-    if (Browser.isEdge() || Browser.isIE()) {
-      try {
-        iframeElement.contentWindow.document.execCommand('print', false, null)
-      } catch (e) {
-        iframeElement.contentWindow.print()
-      }
-    } else {
-      // Other browsers
-      iframeElement.contentWindow.print()
-    }
-  } catch (error) {
-    params.onError(error)
-  } finally {
-    if (Browser.isFirefox()) {
-      // Move the iframe element off-screen and make it invisible
-      iframeElement.style.visibility = 'hidden'
-      iframeElement.style.left = '-1px'
-    }
-
-    cleanUp(params)
-  }
-}
-
-function loadIframeImages (images) {
-  const promises = images.map(image => {
-    if (image.src && image.src !== window.location.href) {
-      return loadIframeImage(image)
-    }
-  })
-
-  return Promise.all(promises)
-}
-
-function loadIframeImage (image) {
-  return new Promise(resolve => {
-    const pollImage = () => {
-      !image || typeof image.naturalWidth === 'undefined' || image.naturalWidth === 0 || !image.complete
-        ? setTimeout(pollImage, 500)
-        : resolve()
-    }
-    pollImage()
-  })
-}
-
-export default Print

+ 0 - 15
src/utils/Print/src/js/raw-html.js

@@ -1,15 +0,0 @@
-import Print from './print'
-
-export default {
-  print: (params, printFrame) => {
-    // Create printable element (container)
-    params.printableElement = document.createElement('div')
-    params.printableElement.setAttribute('style', 'width:100%')
-
-    // Set our raw html as the printable element inner html content
-    params.printableElement.innerHTML = params.printable
-
-    // Print html contents
-    Print.send(params, printFrame)
-  }
-}

+ 0 - 14
src/utils/Print/src/sass/index.scss

@@ -1,14 +0,0 @@
-/*
-|--------------------------------------------------------------------------
-| Modules
-|--------------------------------------------------------------------------
-*/
-@import './modules/colors';
-
-/*
-|--------------------------------------------------------------------------
-| Partials
-|--------------------------------------------------------------------------
-*/
-@import './partials/modal';
-@import './partials/spinner';

+ 0 - 10
src/utils/Print/src/sass/modules/_colors.scss

@@ -1,10 +0,0 @@
-$blue: hsl(209, 96%, 36%);
-$white: hsl(0, 0%, 100%);
-
-/*
-|--------------------------------------------------------------------------
-| Aliases
-|--------------------------------------------------------------------------
-*/
-$primary: $blue;
-$bg-color: rgba($white, .9);

+ 0 - 41
src/utils/Print/src/sass/partials/_modal.scss

@@ -1,41 +0,0 @@
-.printModal {
-  font-family:sans-serif;
-  display:flex;
-  text-align:center;
-  font-weight:300;
-  font-size:30px;
-  left:0;
-  top:0;
-  position:absolute;
-  color: $primary;
-  width: 100%;
-  height: 100%;
-  background-color: $bg-color;
-}
-
-/*
-|--------------------------------------------------------------------------
-| Close Button
-|--------------------------------------------------------------------------
-*/
-.printClose {
-  position:absolute;
-  right:10px;
-  top:10px;
-}
-
-.printClose:before {
-  content: "\00D7";
-  font-family: "Helvetica Neue", sans-serif;
-  font-weight: 100;
-  line-height: 1px;
-  padding-top: 0.5em;
-  display: block;
-  font-size: 2em;
-  text-indent: 1px;
-  overflow: hidden;
-  height: 1.25em;
-  width: 1.25em;
-  text-align: center;
-  cursor: pointer;
-}

+ 0 - 46
src/utils/Print/src/sass/partials/_spinner.scss

@@ -1,46 +0,0 @@
-.printSpinner {
-  margin-top: 3px;
-  margin-left: -40px;
-  position: absolute;
-  display: inline-block;
-  width: 25px;
-  height: 25px;
-	border: 2px solid $primary;
-  border-radius: 50%;
-  animation: spin 0.75s infinite linear;
-}
-
-.printSpinner::before, .printSpinner::after {
-  left: -2px;
-  top: -2px;
-  display: none;
-  position: absolute;
-  content: '';
-  width: inherit;
-  height: inherit;
-  border: inherit;
-  border-radius: inherit;
-}
-
-.printSpinner, .printSpinner::before, .printSpinner::after {
-  display: inline-block;
-  border-color: transparent;
-  border-top-color: $primary;
-  animation-duration: 1.2s;
-}
-.printSpinner::before {
-  transform: rotate(120deg);
-}
-.printSpinner::after {
-  transform: rotate(240deg);
-}
-
-/* Keyframes for the animation */
-@keyframes spin {
-  from {
-    transform: rotate(0deg);
-  }
-  to {
-    transform: rotate(360deg);
-  }
-}

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
src/utils/Print/test/manual/base64.txt


+ 0 - 308
src/utils/Print/test/manual/index.html

@@ -1,308 +0,0 @@
-<html>
-	<link rel="stylesheet" href="../../dist/print.css" type="text/css">
-  <script src='../../dist/print.js'></script>
-  <script type="text/javascript">
-    function printPdf() {
-      printJS('/test/manual/test.pdf')
-    }
-
-    function printPdfWithModal() {
-      printJS({
-        printable: '/test/manual/test.pdf',
-        type: 'pdf',
-        showModal: true,
-				base64: false,
-      })
-    }
-
-    function printPdfWithModalAndCloseCallback() {
-      printJS({
-        printable: '/test/manual/test.pdf',
-        type: 'pdf',
-        showModal: true,
-        onPrintDialogClose: () => alert('The print dialog was closed'),
-        onIncompatibleBrowser: () => console.log('Pdf was opened in a new tab due to an incompatible browser')
-      })
-    }
-
-    function printPdfBase64() {
-      fetch('/test/manual/base64.txt').then(function(response) {
-        response.text().then(function(base64) {
-          printJS({
-            printable: base64,
-            type: 'pdf',
-            base64: true
-          })
-        })
-      })
-    }
-
-    function printHtml() {
-      printJS({
-        printable: 'test',
-        type: 'html'
-      })
-    }
-
-    function printRawHtml() {
-      printJS({
-        printable: `<h1>Print.js Raw HTML Print Test</h1>
-        <p class="blueText">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
-        <p>sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>`,
-        type: 'raw-html',
-        style: '.blueText {color:blue;}'
-      })
-    }
-
-    function printHtmlCustomStyle() {
-      const style = '@page { margin-top: 400px } @media print { h1 { color: blue } }'
-
-      printJS({
-        printable: 'test',
-        type: 'html',
-        style: style,
-        scanStyles: false
-      })
-    }
-
-    function printHtmlCss() {
-      printJS({
-        printable: 'test',
-        type: 'html',
-        css: 'test.css',
-        scanStyles: false
-      })
-    }
-
-    function printJson() {
-      let data = []
-      for (let i=0; i <= 1000; i++) {
-        data.push({
-          test1: createRandomString(),
-          test2: createRandomString()
-        })
-      }
-
-      printJS({
-        printable: data,
-        properties: [
-          {
-            field: 'test1',
-            displayName: 'test 1',
-            columnSize: 1
-          },
-          {
-            field: 'test2',
-            displayName: 'test 2',
-            columnSize: 4
-          }
-        ],
-        type: 'json',
-				header: 'JSON Print Test',
-				documentTitle: 'Print.js JSON Test'
-      })
-    }
-
-    function printStyledJson() {
-      let data = [
-        {
-          test1: 'Test1 string',
-          test2: 'Test2 string'
-        },
-        {
-          test1: 'more Test1 string',
-          test2: 'more Test2 string'
-        }
-      ]
-
-      printJS({
-        printable: data,
-        properties: ['test1', 'test2'],
-        type: 'json',
-        gridStyle: 'border: 2px solid #3971A5;',
-				gridHeaderStyle: 'color: red;  border: 2px solid #3971A5;',
-      })
-    }
-
-    function printNestedJson() {
-      let data = []
-      for (let i=0; i <= 100; i++) {
-        data.push({
-          test1: createRandomString(),
-          test2: {
-            a: createRandomString()
-          }
-        })
-      }
-
-      printJS({
-        printable: data,
-        properties: [
-          {
-            field: 'test1',
-            displayName: 'test 1',
-            columnSize: 1
-          },
-          {
-            field: 'test2.a',
-            displayName: 'test 2 - a',
-            columnSize: 4
-          }
-        ],
-        type: 'json'
-      })
-    }
-
-    function createRandomString() {
-      var text = "";
-      var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-
-      for (var i = 0; i < 5; i++)
-        text += possible.charAt(Math.floor(Math.random() * possible.length));
-
-      return text;
-    }
-
-    function printImage() {
-      printJS('test-01.jpg', 'image')
-    }
-
-    function printImages() {
-      printJS({
-        printable: [
-          'test-01.jpg',
-          'test-02.jpg'
-        ],
-        type: 'image'
-      })
-    }
-
-    function printStyledImages() {
-      printJS({
-        printable: [
-          'test-01.jpg',
-          'test-02.jpg'
-        ],
-        type: 'image',
-        style: 'img { max-width: 400px; margin: 30px; }'
-      })
-    }
-
-    function printStyledImagesWithStyleSheet() {
-      printJS({
-        printable: [
-          'test-01.jpg',
-          'test-02.jpg'
-        ],
-        type: 'image',
-        css: 'test.css',
-      })
-    }
-
-    function printExternalImages() {
-      printJS({
-        printable: [
-          'https://printjs.crabbly.com/images/print-01-highres.jpg',
-          'https://printjs.crabbly.com/images/print-02-highres.jpg',
-          'https://printjs.crabbly.com/images/print-03-highres.jpg'
-        ],
-        type: 'image',
-        showModal: true,
-        modalMessage: 'Printing...'
-      })
-    }
-  </script>
-  <body>
-    <section id="test" class="test">
-      <h1>Print.js Test Page</h1>
-      <p>
-        <button onClick='printPdf();'>
-          Print PDF
-        </button>
-        <button onClick='printPdfWithModal();'>
-          Print PDF with Loading Modal
-        </button>
-        <button onClick='printPdfWithModalAndCloseCallback();'>
-          Print PDF with Loading Modal and close callback
-        </button>
-        <button onClick='printPdfBase64();'>
-          Print base64 PDF
-        </button>
-      </p>
-      <p>
-        <button onClick='printHtml();'>
-          Print HTML
-        </button>
-        <button onClick='printHtmlCustomStyle();'>
-          Print HTML with custom style
-        </button>
-        <button onClick='printHtmlCss();'>
-          Print HTML with custom css
-        </button>
-        <button onClick='printRawHtml();'>
-          Print Raw HTML
-        </button>
-      </p>
-      <p>
-        <button onClick='printJson();'>
-          Print JSON
-        </button>
-        <button onClick='printStyledJson();'>
-          Print Styled JSON
-        </button>
-        <button onClick='printNestedJson();'>
-          Print Nested JSON
-        </button>
-      </p>
-      <p>
-        <button onClick='printImage();'>
-          Print Image
-        </button>
-        <button onClick='printImages();'>
-          Print Multiple Images
-        </button>
-        <button onClick='printStyledImages();'>
-          Print Multiple Images Passing Custom Style
-        </button>
-        <button onClick='printStyledImagesWithStyleSheet();'>
-          Print Multiple Images Passing a Style Sheet
-        </button>
-        <button onClick='printExternalImages();'>
-          Print Multiple External Images
-        </button>
-      </p>
-      <div>
-        <h2>Form Elements</h2>
-        <div>
-          <input type="checkbox" /> Checkbox Example
-        </div>
-        <div>
-            <input type="text" value="Styled text input content..." style="color: red; min-width: 300px;" />
-        </div>
-        <div>
-            <textarea>Text area content...</textarea>
-        </div>
-        <div>
-            <canvas id="myCanvas" width="200" height="50"
-            style="border:2px solid blue;">
-            Your browser does not support the canvas element.
-            </canvas>
-
-            <script>
-              var canvas = document.getElementById("myCanvas");
-              var ctx = canvas.getContext("2d");
-              ctx.fillStyle = "#FF0000";
-              ctx.fillRect(0,0,150,25);
-            </script>
-        </div>
-        <div>
-          <select>
-            <option value="super" selected>Super</option>
-            <option value="test">Test</option>
-            <option value="printjs">Print.js</option>
-          </select>
-        </div>
-      </div>
-    </section>
-  </body>
-</html>

BIN
src/utils/Print/test/manual/test-01.jpg


BIN
src/utils/Print/test/manual/test-02.jpg


+ 0 - 11
src/utils/Print/test/manual/test.css

@@ -1,11 +0,0 @@
-@media print {
-    h1 {
-        color: red;
-        font-size: 40px;
-    }
-}
-
-img {
-    max-width: 500px;
-    margin: 50px;
-}

+ 0 - 23
src/utils/Print/test/manual/test.pdf

@@ -1,23 +0,0 @@
-                    PrintJS
-
-             PDF Page Example
-
-Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc egestas vel lorem
-vitae placerat. Sed ut tempus quam. Nunc ut sollicitudin sem. Pellentesque id orci
-non felis sodales cursus. Vivamus a odio massa. Vestibulum sit amet finibus lorem.
-Pellentesque finibus sem tincidunt volutpat suscipit. Morbi libero urna, tincidunt
-nec commodo semper, iaculis sit amet ligula. Class aptent taciti sociosqu ad litora
-torquent per conubia nostra, per inceptos himenaeos. Nam tortor nibh, finibus non
-metus ut, commodo gravida tortor. Nulla sagittis ut enim a imperdiet. Nulla a
-sodales odio..
-
-Integer porta viverra lacinia. Nulla facilisi. Aenean fermentum, justo sed fermentum
-facilisis, lorem ligula faucibus diam, ut egestas justo nisi quis odio. Cras sagittis,
-nulla molestie semper varius, felis lorem ornare turpis, sed sagittis lectus purus quis
-erat. Aenean aliquet neque vitae diam fringilla, vel porttitor justo elementum.
-Nullam scelerisque rhoncus orci, non elementum tellus sagittis quis. Mauris sem
-lectus, lacinia eget imperdiet sed, suscipit id leo. Duis volutpat risus ac dictum
-ullamcorper. Suspendisse rutrum varius facilisis.
-
-                                          printjs.crabbly.com
-

+ 0 - 40
src/utils/Print/test/unit/browser.spec.js

@@ -1,40 +0,0 @@
-import Browser from '../../src/js/browser'
-
-describe('Browser', () => {
-  it('has a function named isFirefox that returns a boolean value', () => {
-    expect(typeof Browser.isFirefox).toBe('function')
-    expect(typeof Browser.isFirefox()).toBe('boolean')
-  })
-
-  it('has a function named isIE that returns a boolean value', () => {
-    expect(typeof Browser.isIE).toBe('function')
-    expect(typeof Browser.isIE()).toBe('boolean')
-  })
-
-  it('has a function named isEdge that returns a boolean value', () => {
-    expect(typeof Browser.isEdge).toBe('function')
-    expect(typeof Browser.isEdge()).toBe('boolean')
-  })
-
-  it('has a function named isChrome that returns a boolean value', () => {
-    expect(typeof Browser.isChrome).toBe('function')
-    expect(typeof Browser.isChrome()).toBe('boolean')
-  })
-
-  describe('isChrome()', () => {
-    it('returns true for Google Chrome', () => {
-      const stubbedWindow = { chrome: {} }
-      expect(Browser.isChrome(stubbedWindow)).toBeTruthy()
-    })
-
-    it('returns false for non Google Chrome', () => {
-      const stubbedWindow = {}
-      expect(Browser.isChrome(stubbedWindow)).toBeFalsy()
-    })
-  })
-
-  it('has a function named isSafari that returns a boolean value', () => {
-    expect(typeof Browser.isSafari).toBe('function')
-    expect(typeof Browser.isSafari()).toBe('boolean')
-  })
-})

+ 0 - 31
src/utils/Print/test/unit/functions.spec.js

@@ -1,31 +0,0 @@
-import { addWrapper, capitalizePrint, isRawHTML } from '../../src/js/functions'
-
-describe('addWrapper()', () => {
-  it('add a div wrapper to a raw html', () => {
-    const params = {
-      font: 'TimesNewRoman',
-      font_size: '12px'
-    }
-    expect(addWrapper('<span>Test</span>', params)).toBe('<div style="font-family:' + params.font + ' !important; font-size: ' + params.font_size + ' !important; width:100%;"><span>Test</span></div>')
-  })
-})
-
-describe('capitalizePrint()', () => {
-  it('should capitalize the first letter of a string', () => {
-    expect(capitalizePrint('test')).toBe('Test')
-  })
-})
-
-describe('isRawHTML()', () => {
-  it('string `My Header` return `false`', () => {
-    expect(isRawHTML('My Header')).toBe(false)
-  })
-
-  it('`<h1>My HTML Header</h1>` return `true`', () => {
-    expect(isRawHTML('<h1>My HTML Header</h1>')).toBe(true)
-  })
-
-  it('`<h1>HTML syntax error` return `false`', () => {
-    expect(isRawHTML('<h1>HTML syntax error')).toBe(false)
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/html.spec.js

@@ -1,7 +0,0 @@
-import Html from '../../src/js/html'
-
-describe('Html', () => {
-  it('has a method named print', () => {
-    expect(typeof Html.print).toBe('function')
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/image.spec.js

@@ -1,7 +0,0 @@
-import Image from '../../src/js/image'
-
-describe('Image', () => {
-  it('has a method named print', () => {
-    expect(typeof Image.print).toBe('function')
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/init.spec.js

@@ -1,7 +0,0 @@
-import Init from '../../src/js/init'
-
-describe('Init Module', () => {
-  it('has a function named init', () => {
-    expect(typeof Init.init).toBe('function')
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/json.spec.js

@@ -1,7 +0,0 @@
-import Json from '../../src/js/json'
-
-describe('Json', () => {
-  it('has a method named print', () => {
-    expect(typeof Json.print).toBe('function')
-  })
-})

+ 0 - 11
src/utils/Print/test/unit/modal.spec.js

@@ -1,11 +0,0 @@
-import Modal from '../../src/js/modal'
-
-describe('Modal', () => {
-  it('has a method named show', () => {
-    expect(typeof Modal.show).toBe('function')
-  })
-
-  it('has a method named close', () => {
-    expect(typeof Modal.close).toBe('function')
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/pdf.spec.js

@@ -1,7 +0,0 @@
-import Pdf from '../../src/js/pdf'
-
-describe('Pdf', () => {
-  it('has a method named print', () => {
-    expect(typeof Pdf.print).toBe('function')
-  })
-})

+ 0 - 7
src/utils/Print/test/unit/print.spec.js

@@ -1,7 +0,0 @@
-import Print from '../../src/js/print'
-
-describe('Print', () => {
-  it('has a method named send', () => {
-    expect(typeof Print.send).toBe('function')
-  })
-})

+ 0 - 87
src/utils/Print/webpack.config.js

@@ -1,87 +0,0 @@
-const path = require('path')
-const TerserPlugin = require('terser-webpack-plugin')
-const MiniCssExtractPlugin = require('mini-css-extract-plugin')
-const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
-
-module.exports = {
-  mode: 'development',
-  devtool: 'source-map',
-  entry: [
-    './src/index.js'
-  ],
-  output: {
-    library: 'printJS',
-    libraryTarget: 'umd',
-    path: path.resolve(__dirname, 'dist'),
-    filename: 'print.js',
-    sourceMapFilename: 'print.map',
-    libraryExport: 'default'
-  },
-  module: {
-    rules: [
-      {
-        test: /\.js$/,
-        exclude: /node_modules/,
-        use: {
-          loader: 'babel-loader'
-        }
-      },
-      // TODO: Configure istanbul to interpret how webpack bundles files
-      // {
-      //   test: /\.js$/,
-      //   use: {
-      //     loader: 'istanbul-instrumenter-loader',
-      //     options: { esModules: true }
-      //   },
-      //   enforce: 'post',
-      //   exclude: /node_modules|\.spec\.js$/
-      // },
-      {
-        test: /\.scss$/,
-        use: [
-          {
-            loader: MiniCssExtractPlugin.loader,
-            options: {
-              sourceMap: true
-            }
-          },
-          {
-            loader: 'css-loader',
-            options: {
-              sourceMap: true
-            }
-          },
-          {
-            loader: 'sass-loader',
-            options: {
-              sourceMap: true
-            }
-          }
-        ]
-      }
-    ]
-  },
-  plugins: [
-    new MiniCssExtractPlugin({
-      filename: 'print.css'
-    })
-  ],
-  optimization: {
-    minimizer: [
-      new OptimizeCssAssetsPlugin({
-        assetNameRegExp: /\.css$/g,
-        canPrint: false
-      }),
-      new TerserPlugin({
-        cache: false,
-        parallel: true,
-        sourceMap: true, // Must be set to true if using source-maps in production
-        terserOptions: {
-          mangle: true,
-          ie8: true,
-          safari10: true
-        }
-      })
-    ]
-  }
-}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.