@macallumharvey/first-test-wet 2.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/WetButton.d.ts +1 -1
- package/dist/first-test-wet.cjs.development.js +5 -0
- package/dist/first-test-wet.cjs.development.js.map +1 -1
- package/dist/first-test-wet.cjs.production.min.js +1 -1
- package/dist/first-test-wet.cjs.production.min.js.map +1 -1
- package/dist/first-test-wet.esm.js +5 -1
- package/dist/first-test-wet.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/WetButton.tsx +1 -1
- package/src/WetModal.tsx +1 -0
- package/src/index.tsx +1 -0
- package/src/theme-wet-boew/assets/favicon-mobile.png +0 -0
- package/src/theme-wet-boew/assets/favicon.ico +0 -0
- package/src/theme-wet-boew/assets/logo.png +0 -0
- package/src/theme-wet-boew/assets/logo.svg +14 -0
- package/src/theme-wet-boew/css/ie8-theme.css +17370 -0
- package/src/theme-wet-boew/css/ie8-theme.min.css +193 -0
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.js → theme-wet-boew/css/ie8-wet-boew.css} +12 -10
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js → theme-wet-boew/css/ie8-wet-boew.min.css} +7 -7
- package/src/theme-wet-boew/css/theme.css +11357 -0
- package/src/theme-wet-boew/css/theme.min.css +6 -0
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.js → theme-wet-boew/css/wet-boew.css} +12 -10
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js → theme-wet-boew/css/wet-boew.min.css} +6 -7
- package/src/theme-wet-boew/payload.json +66 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/mediacontrols.html +32 -33
- package/src/wet-boew/assets/sprites_share.png +0 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.css +112 -112
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.min.css +5 -5
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.css +32 -32
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.css +47 -47
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.css +28 -28
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.css +16 -16
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.css +24 -24
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.css +8 -8
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.css +229 -229
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.svg +287 -287
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/additional-methods.js +1511 -1511
- package/src/wet-boew/js/deps/additional-methods.min.js +9 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/geomap-lib.js +3758 -3770
- package/src/wet-boew/js/deps/geomap-lib.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.dataTables.js +15345 -15733
- package/src/wet-boew/js/deps/jquery.dataTables.min.js +4 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.canvas.js +345 -345
- package/src/wet-boew/js/deps/jquery.flot.canvas.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.js +3168 -3168
- package/src/wet-boew/js/deps/jquery.flot.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.orderBars.js +282 -282
- package/src/wet-boew/js/deps/jquery.flot.orderBars.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.pie.js +820 -820
- package/src/wet-boew/js/deps/jquery.flot.pie.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.magnific-popup.js +2060 -2060
- package/src/wet-boew/js/deps/jquery.magnific-popup.min.js +4 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.validate.js +1660 -1660
- package/src/wet-boew/js/deps/jquery.validate.min.js +9 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/json-patch.js +314 -314
- package/src/wet-boew/js/deps/json-patch.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jsonpointer.js +349 -349
- package/src/wet-boew/js/deps/jsonpointer.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.js +53 -53
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.js +64 -64
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.js +160 -160
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.js +92 -92
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.js +94 -94
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.js +102 -102
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.js +95 -95
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.js +63 -63
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.js +60 -60
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.js +183 -183
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.min.js +1 -1
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.js +57 -57
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.js +140 -140
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.js +37 -37
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.js +81 -81
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.js +56 -56
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.js +60 -60
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.js +63 -63
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.js +51 -51
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.js +55 -55
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.js +71 -71
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.js +45 -45
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/ol.js +1008 -1008
- package/src/wet-boew/js/deps/ol.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/prettify.js +1742 -1742
- package/src/wet-boew/js/deps/prettify.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/proj4.js +2 -2
- package/src/wet-boew/js/deps/proj4.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/run_prettify.js +1998 -1998
- package/src/wet-boew/js/deps/run_prettify.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/tableparser.js +2216 -2216
- package/src/wet-boew/js/deps/tableparser.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/unorm.js +452 -452
- package/src/wet-boew/js/deps/unorm.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/af.js +246 -254
- package/src/wet-boew/js/i18n/af.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ar.js +284 -292
- package/src/wet-boew/js/i18n/ar.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/bg.js +284 -292
- package/src/wet-boew/js/i18n/bg.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/cs.js +285 -293
- package/src/wet-boew/js/i18n/cs.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/de.js +354 -362
- package/src/wet-boew/js/i18n/de.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/el.js +284 -292
- package/src/wet-boew/js/i18n/el.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/en.js +246 -254
- package/src/wet-boew/js/i18n/en.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/es.js +287 -295
- package/src/wet-boew/js/i18n/es.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/et.js +282 -290
- package/src/wet-boew/js/i18n/et.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/fr.js +313 -321
- package/src/wet-boew/js/i18n/fr.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hi.js +246 -254
- package/src/wet-boew/js/i18n/hi.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hu.js +284 -292
- package/src/wet-boew/js/i18n/hu.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hy.js +246 -254
- package/src/wet-boew/js/i18n/hy.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/id.js +283 -291
- package/src/wet-boew/js/i18n/id.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/is.js +282 -290
- package/src/wet-boew/js/i18n/is.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/it.js +311 -319
- package/src/wet-boew/js/i18n/it.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/iu.js +246 -254
- package/src/wet-boew/js/i18n/iu.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ja.js +285 -293
- package/src/wet-boew/js/i18n/ja.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ko.js +284 -292
- package/src/wet-boew/js/i18n/ko.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lt.js +284 -292
- package/src/wet-boew/js/i18n/lt.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lv.js +284 -292
- package/src/wet-boew/js/i18n/lv.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/nl.js +318 -326
- package/src/wet-boew/js/i18n/nl.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pl.js +287 -295
- package/src/wet-boew/js/i18n/pl.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt-BR.js +246 -254
- package/src/wet-boew/js/i18n/pt-BR.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt.js +270 -278
- package/src/wet-boew/js/i18n/pt.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ru.js +284 -292
- package/src/wet-boew/js/i18n/ru.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sk.js +282 -290
- package/src/wet-boew/js/i18n/sk.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sq.js +246 -254
- package/src/wet-boew/js/i18n/sq.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/th.js +284 -292
- package/src/wet-boew/js/i18n/th.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/tr.js +286 -294
- package/src/wet-boew/js/i18n/tr.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/uk.js +284 -292
- package/src/wet-boew/js/i18n/uk.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/vi.js +284 -292
- package/src/wet-boew/js/i18n/vi.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh-Hans.js +246 -254
- package/src/wet-boew/js/i18n/zh-Hans.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh.js +285 -293
- package/src/wet-boew/js/i18n/zh.min.js +7 -0
- package/src/wet-boew/js/ie8-wet-boew.js +3992 -0
- package/src/wet-boew/js/ie8-wet-boew.min.js +7 -0
- package/src/wet-boew/js/ie8-wet-boew2.js +15294 -0
- package/src/wet-boew/js/ie8-wet-boew2.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.js +9814 -9814
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.js +4 -4
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist.js +423 -419
- package/src/wet-boew/js/polyfills/datalist.min.js +8 -0
- package/src/wet-boew/js/polyfills/datalist.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.min.js +7 -7
- package/src/wet-boew/js/polyfills/datalist_dynamic.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datepicker.js +338 -338
- package/src/wet-boew/js/polyfills/datepicker.min.js +8 -0
- package/src/wet-boew/js/polyfills/datepicker.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/details.js +126 -126
- package/src/wet-boew/js/polyfills/details.min.js +8 -0
- package/src/wet-boew/js/polyfills/details.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.js +47 -47
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.min.js +15 -15
- package/src/wet-boew/js/polyfills/jawsariafixes.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/meter.js +140 -140
- package/src/wet-boew/js/polyfills/meter.min.js +8 -0
- package/src/wet-boew/js/polyfills/meter.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/mobile.js +783 -784
- package/src/wet-boew/js/polyfills/mobile.min.js +8 -0
- package/src/wet-boew/js/polyfills/mobile.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/progress.js +107 -107
- package/src/wet-boew/js/polyfills/progress.min.js +8 -0
- package/src/wet-boew/js/polyfills/progress.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider.js +1343 -1343
- package/src/wet-boew/js/polyfills/slider.min.js +9 -0
- package/src/wet-boew/js/polyfills/slider.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.js +73 -73
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.min.js +7 -7
- package/src/wet-boew/js/polyfills/slider_wrapper.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.js +29 -29
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.min.js +7 -7
- package/src/wet-boew/js/polyfills/svg.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.js +603 -603
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.min.js +7 -7
- package/src/wet-boew/js/polyfills/test.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/wet-boew.js +17714 -20264
- package/src/wet-boew/js/wet-boew.min.js +9 -0
- package/src/wet-boew/js/wet-boew.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/payload.json +1721 -1721
- package/src/wet-boew-cdn-4.0.81.1/Licence-fr.txt +0 -1
- package/src/wet-boew-cdn-4.0.81.1/License-en.txt +0 -1
- package/src/wet-boew-cdn-4.0.81.1/assets/sprites_share.png +0 -0
- package/src/wet-boew-cdn-4.0.81.1/js/deps/additional-methods.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/deps/geomap-lib.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.dataTables.min.js +0 -4
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.canvas.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.orderBars.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.pie.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.magnific-popup.min.js +0 -4
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.validate.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/deps/json-patch.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jsonpointer.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/ol.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/prettify.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/proj4.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/run_prettify.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/tableparser.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/unorm.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/af.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ar.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/bg.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/cs.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/de.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/el.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/en.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/es.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/et.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/fr.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hi.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hu.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hy.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/id.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/is.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/it.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/iu.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ja.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ko.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/lt.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/lv.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/nl.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pl.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt-BR.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ru.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/sk.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/sq.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/th.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/tr.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/uk.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/vi.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh-Hans.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist_dynamic.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/jawsariafixes.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider_wrapper.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/svg.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/test.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/package.json +0 -15
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/cloud-popup-relative.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/fd-slider-sprite.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/loading.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-minus-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-plus-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-world-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.eot +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.ttf +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff2 +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/mml-chtml.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.map +0 -0
@@ -1,2216 +1,2216 @@
|
|
1
|
-
/**
|
2
|
-
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
|
3
|
-
* @title Table Parser Plugin
|
4
|
-
* @overview Digest complex tabular data and validate complex table
|
5
|
-
* @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
|
6
|
-
* @author @duboisp
|
7
|
-
*
|
8
|
-
*/
|
9
|
-
( function( $, window, document, wb ) {
|
10
|
-
"use strict";
|
11
|
-
|
12
|
-
/*
|
13
|
-
* Variable and function definitions.
|
14
|
-
* These are global to the plugin - meaning that they will be initialized once per page,
|
15
|
-
* not once per instance of plugin on the page. So, this is a good place to define
|
16
|
-
* variables that are common to all instances of the plugin on a page.
|
17
|
-
*/
|
18
|
-
var componentName = "wb-tableparser",
|
19
|
-
selector = "." + componentName,
|
20
|
-
errorEvent = "error" + selector,
|
21
|
-
warningEvent = "warning" + selector,
|
22
|
-
$document = wb.doc,
|
23
|
-
|
24
|
-
/**
|
25
|
-
* @method init
|
26
|
-
* @param {jQuery Event} event Event that triggered this handler
|
27
|
-
*/
|
28
|
-
init = function( event ) {
|
29
|
-
if ( event.namespace !== componentName ) {
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
|
33
|
-
var $obj = $( event.target ),
|
34
|
-
groupZero = {
|
35
|
-
allParserObj: [],
|
36
|
-
nbDescriptionRow: 0 /* To remove ?? */
|
37
|
-
},
|
38
|
-
colgroupFrame = [],
|
39
|
-
columnFrame = [],
|
40
|
-
uidElem = 0,
|
41
|
-
currentRowPos = 0,
|
42
|
-
spannedRow = [],
|
43
|
-
tableCellWidth = 0,
|
44
|
-
headerRowGroupCompleted = false,
|
45
|
-
theadRowStack = [],
|
46
|
-
stackRowHeader = false,
|
47
|
-
|
48
|
-
// Row Group Variable
|
49
|
-
rowgroupHeaderRowStack = [],
|
50
|
-
currentRowGroup,
|
51
|
-
currentRowGroupElement,
|
52
|
-
lstRowGroup = [],
|
53
|
-
rowgroupheadercalled = false,
|
54
|
-
hasTfoot = $obj.has( "tfoot" ),
|
55
|
-
lastHeadingSummaryColPos,
|
56
|
-
previousDataHeadingColPos,
|
57
|
-
tfootOnProcess = false,
|
58
|
-
hassumMode = false;
|
59
|
-
|
60
|
-
// obj need to be a table
|
61
|
-
if ( $obj.get( 0 ).nodeName.toLowerCase() !== "table" ) {
|
62
|
-
$obj.trigger( {
|
63
|
-
type: errorEvent,
|
64
|
-
pointer: $obj,
|
65
|
-
err: 1
|
66
|
-
} );
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
|
70
|
-
// Check if this table was already parsed, if yes we exit by throwing an error
|
71
|
-
if ( $obj.tblparser ) {
|
72
|
-
$obj.trigger( {
|
73
|
-
type: errorEvent,
|
74
|
-
pointer: $obj,
|
75
|
-
err: 2
|
76
|
-
} );
|
77
|
-
return;
|
78
|
-
}
|
79
|
-
|
80
|
-
// Check for hassum mode
|
81
|
-
hassumMode = $obj.hasClass( "hassum" );
|
82
|
-
|
83
|
-
/*
|
84
|
-
+-----------------------------------------------------+
|
85
|
-
| FYI - Here the value and signification of each type |
|
86
|
-
+-------+---------------+-----------------------------+
|
87
|
-
| Type | Signification | Technicality
|
88
|
-
+-------+---------------+------------------------------
|
89
|
-
| 1 | Header | TH element only
|
90
|
-
+-------+---------------+------------------------------
|
91
|
-
| 2 | Data | TD element only
|
92
|
-
+-------+---------------+------------------------------
|
93
|
-
| 3 | Summary | TD element and TD of type 2 exist
|
94
|
-
+-------+---------------+------------------------------
|
95
|
-
| 4 | Key | TD element applicable to right TH, Only available on row
|
96
|
-
+-------+---------------+------------------------------
|
97
|
-
| 5 | Description | TD element applicable to left or top TH
|
98
|
-
+-------+---------------+------------------------------
|
99
|
-
| 6 | Layout | Can be only: Top Left cell or/and Summmary group intersection
|
100
|
-
+-------+---------------+------------------------------
|
101
|
-
| 7 | Header Group | TH element only, visual heading grouping, this type are an extension of the type 1
|
102
|
-
+-------+---------------+------------------------------
|
103
|
-
*/
|
104
|
-
$obj.data().tblparser = groupZero;
|
105
|
-
groupZero.colgroup = colgroupFrame;
|
106
|
-
if ( !groupZero.rowgroup ) {
|
107
|
-
groupZero.rowgroup = [];
|
108
|
-
}
|
109
|
-
if ( !groupZero.lstrowgroup ) {
|
110
|
-
groupZero.lstrowgroup = lstRowGroup;
|
111
|
-
}
|
112
|
-
groupZero.elem = $obj;
|
113
|
-
groupZero.uid = uidElem;
|
114
|
-
|
115
|
-
// Set the uid for the groupZero
|
116
|
-
uidElem += 1;
|
117
|
-
|
118
|
-
// Group Cell Header at level 0, scope=col
|
119
|
-
groupZero.colcaption = {};
|
120
|
-
groupZero.colcaption.uid = uidElem;
|
121
|
-
uidElem += 1;
|
122
|
-
groupZero.colcaption.elem = undefined;
|
123
|
-
groupZero.colcaption.type = 7;
|
124
|
-
groupZero.colcaption.dataset = [];
|
125
|
-
groupZero.colcaption.summaryset = [];
|
126
|
-
|
127
|
-
// Group Cell Header at level 0, scope=row
|
128
|
-
groupZero.rowcaption = {};
|
129
|
-
groupZero.rowcaption.uid = uidElem;
|
130
|
-
uidElem += 1;
|
131
|
-
groupZero.rowcaption.elem = undefined;
|
132
|
-
groupZero.rowcaption.type = 7;
|
133
|
-
groupZero.rowcaption.dataset = [];
|
134
|
-
groupZero.rowcaption.summaryset = [];
|
135
|
-
groupZero.col = [];
|
136
|
-
|
137
|
-
function processCaption( elem ) {
|
138
|
-
groupZero.colcaption.elem = elem;
|
139
|
-
groupZero.rowcaption.elem = elem;
|
140
|
-
var groupheadercell = {
|
141
|
-
colcaption: groupZero.colcaption,
|
142
|
-
rowcaption: groupZero.rowcaption,
|
143
|
-
elem: elem
|
144
|
-
},
|
145
|
-
caption,
|
146
|
-
captionFound,
|
147
|
-
description = [];
|
148
|
-
|
149
|
-
// Extract the caption vs the description
|
150
|
-
// There are 2 techniques,
|
151
|
-
// Recommanded is encapsulate the caption with "strong"
|
152
|
-
// Use Details/Summary element
|
153
|
-
// Use a simple paragraph
|
154
|
-
if ( $( elem ).children().length !== 0 ) {
|
155
|
-
|
156
|
-
// Use the contents function to retrieve the caption
|
157
|
-
$( elem ).contents().filter( function() {
|
158
|
-
|
159
|
-
// Text Node
|
160
|
-
if ( !caption && this.nodeType === 3 ) {
|
161
|
-
|
162
|
-
// Doesn't matter what it is, but this will be
|
163
|
-
// considered as the caption if is not empty
|
164
|
-
caption = $( this ).text().replace( /^\s+|\s+$/g, "" );
|
165
|
-
if ( caption.length !== 0 ) {
|
166
|
-
caption = this;
|
167
|
-
captionFound = true;
|
168
|
-
return;
|
169
|
-
}
|
170
|
-
caption = false;
|
171
|
-
} else if ( !caption && this.nodeType === 1 ) {
|
172
|
-
|
173
|
-
// Doesn't matter what it is, the first children
|
174
|
-
// element will be considered as the caption
|
175
|
-
caption = this;
|
176
|
-
return;
|
177
|
-
}
|
178
|
-
} );
|
179
|
-
|
180
|
-
// Use the children function to retrieve the description
|
181
|
-
$( elem ).children().filter( function() {
|
182
|
-
|
183
|
-
// if the caption is an element, we should ignore the first one
|
184
|
-
if ( captionFound ) {
|
185
|
-
description.push( this );
|
186
|
-
} else {
|
187
|
-
captionFound = true;
|
188
|
-
}
|
189
|
-
} );
|
190
|
-
} else {
|
191
|
-
caption = elem;
|
192
|
-
}
|
193
|
-
|
194
|
-
// Move the description in a wrapper if there is more than one element
|
195
|
-
if ( description.length > 1 ) {
|
196
|
-
groupheadercell.description = $( description );
|
197
|
-
} else if ( description.length === 1 ) {
|
198
|
-
groupheadercell.description = description[ 0 ];
|
199
|
-
}
|
200
|
-
if ( caption ) {
|
201
|
-
groupheadercell.caption = caption;
|
202
|
-
}
|
203
|
-
groupheadercell.groupZero = groupZero;
|
204
|
-
groupheadercell.type = 1;
|
205
|
-
groupZero.groupheadercell = groupheadercell;
|
206
|
-
$( elem ).data().tblparser = groupheadercell;
|
207
|
-
}
|
208
|
-
function processColgroup( elem, nbvirtualcol ) {
|
209
|
-
|
210
|
-
// if elem is undefined, this mean that is an big empty colgroup
|
211
|
-
// nbvirtualcol if defined is used to create the virtual colgroup
|
212
|
-
var colgroup = {
|
213
|
-
elem: {},
|
214
|
-
start: 0,
|
215
|
-
end: 0,
|
216
|
-
col: [],
|
217
|
-
groupZero: groupZero
|
218
|
-
},
|
219
|
-
colgroupspan = 0,
|
220
|
-
width, i, iLen, col;
|
221
|
-
colgroup.elem = elem;
|
222
|
-
if ( elem ) {
|
223
|
-
$( elem ).data().tblparser = colgroup;
|
224
|
-
}
|
225
|
-
colgroup.uid = uidElem;
|
226
|
-
uidElem += 1;
|
227
|
-
groupZero.allParserObj.push( colgroup );
|
228
|
-
if ( colgroupFrame.length !== 0 ) {
|
229
|
-
colgroup.start = colgroupFrame[ colgroupFrame.length - 1 ].end + 1;
|
230
|
-
} else {
|
231
|
-
colgroup.start = 1;
|
232
|
-
}
|
233
|
-
|
234
|
-
// Add any exist structural col element
|
235
|
-
if ( elem ) {
|
236
|
-
$( "col", elem ).each( function() {
|
237
|
-
var $this = $( this ),
|
238
|
-
width = $this.attr( "span" ) !== undefined ?
|
239
|
-
parseInt( $this.attr( "span" ), 10 ) :
|
240
|
-
1,
|
241
|
-
col = {
|
242
|
-
elem: {},
|
243
|
-
start: 0,
|
244
|
-
end: 0,
|
245
|
-
groupZero: groupZero
|
246
|
-
};
|
247
|
-
col.uid = uidElem;
|
248
|
-
uidElem += 1;
|
249
|
-
groupZero.allParserObj.push( col );
|
250
|
-
col.start = colgroup.start + colgroupspan;
|
251
|
-
|
252
|
-
// Minus one because the default value was already calculated
|
253
|
-
col.end = colgroup.start + colgroupspan + width - 1;
|
254
|
-
col.elem = this;
|
255
|
-
col.groupZero = groupZero;
|
256
|
-
$this.data().tblparser = col;
|
257
|
-
colgroup.col.push( col );
|
258
|
-
columnFrame.push( col );
|
259
|
-
colgroupspan += width;
|
260
|
-
} );
|
261
|
-
}
|
262
|
-
|
263
|
-
// If no col element check for the span attribute
|
264
|
-
if ( colgroup.col.length === 0 ) {
|
265
|
-
if ( elem ) {
|
266
|
-
width = $( elem ).attr( "span" ) !== undefined ?
|
267
|
-
parseInt( $( elem ).attr( "span" ), 10 ) :
|
268
|
-
1;
|
269
|
-
} else if ( typeof nbvirtualcol === "number" ) {
|
270
|
-
width = nbvirtualcol;
|
271
|
-
} else {
|
272
|
-
$obj.trigger( {
|
273
|
-
type: errorEvent,
|
274
|
-
pointer: $obj,
|
275
|
-
err: 31
|
276
|
-
} );
|
277
|
-
return;
|
278
|
-
}
|
279
|
-
colgroupspan += width;
|
280
|
-
|
281
|
-
// Create virtual column
|
282
|
-
for ( i = colgroup.start, iLen = ( colgroup.start + colgroupspan ); i !== iLen; i += 1 ) {
|
283
|
-
col = {
|
284
|
-
start: 0,
|
285
|
-
end: 0,
|
286
|
-
groupZero: groupZero,
|
287
|
-
elem: undefined
|
288
|
-
};
|
289
|
-
col.uid = uidElem;
|
290
|
-
uidElem += 1;
|
291
|
-
groupZero.allParserObj.push( col );
|
292
|
-
col.start = i;
|
293
|
-
col.end = i;
|
294
|
-
colgroup.col.push( col );
|
295
|
-
columnFrame.push( col );
|
296
|
-
}
|
297
|
-
}
|
298
|
-
colgroup.end = colgroup.start + colgroupspan - 1;
|
299
|
-
colgroupFrame.push( colgroup );
|
300
|
-
}
|
301
|
-
|
302
|
-
// thead row group processing
|
303
|
-
function processRowgroupHeader( colgroupHeaderColEnd ) {
|
304
|
-
var i, iLen, j, jLen, m, mLen,
|
305
|
-
tmpStack = [], tmpStackCurr, tmpStackCell,
|
306
|
-
dataColgroup, dataColumns, colgroup, col,
|
307
|
-
hcolgroup, currColPos,
|
308
|
-
currColgroupStructure, bigTotalColgroupFound,
|
309
|
-
theadRSNext, theadRSNextCell, cell, gzCol, theadRS;
|
310
|
-
|
311
|
-
if ( groupZero.colgrouphead || rowgroupheadercalled ) {
|
312
|
-
|
313
|
-
// Prevent multiple call
|
314
|
-
return;
|
315
|
-
}
|
316
|
-
rowgroupheadercalled = true;
|
317
|
-
if ( colgroupHeaderColEnd && colgroupHeaderColEnd > 0 ) {
|
318
|
-
|
319
|
-
// The first colgroup must match the colgroupHeaderColEnd
|
320
|
-
if ( colgroupFrame.length > 0 && ( colgroupFrame[ 0 ].start !== 1 ||
|
321
|
-
( colgroupFrame[ 0 ].end !== colgroupHeaderColEnd &&
|
322
|
-
colgroupFrame[ 0 ].end !== ( colgroupHeaderColEnd + 1 ) ) ) ) {
|
323
|
-
|
324
|
-
$obj.trigger( {
|
325
|
-
type: warningEvent,
|
326
|
-
pointer: $obj,
|
327
|
-
err: 3
|
328
|
-
} );
|
329
|
-
|
330
|
-
// Destroy any existing colgroup, because they are not valid
|
331
|
-
colgroupFrame = [];
|
332
|
-
}
|
333
|
-
} else {
|
334
|
-
|
335
|
-
// This mean that are no colgroup designated to be a colgroup header
|
336
|
-
colgroupHeaderColEnd = 0;
|
337
|
-
}
|
338
|
-
|
339
|
-
// Associate any descriptive cell to his top header
|
340
|
-
for ( i = 0, iLen = theadRowStack.length; i !== iLen; i += 1 ) {
|
341
|
-
theadRS = theadRowStack[ i ];
|
342
|
-
if ( !theadRS.type ) {
|
343
|
-
theadRS.type = 1;
|
344
|
-
}
|
345
|
-
|
346
|
-
for ( j = 0, jLen = theadRS.cell.length; j < jLen; j += 1 ) {
|
347
|
-
cell = theadRowStack[ i ].cell[ j ];
|
348
|
-
cell.scope = "col";
|
349
|
-
|
350
|
-
// check if we have a layout cell at the top, left
|
351
|
-
if ( i === 0 && j === 0 && cell.elem.innerHTML.length === 0 ) {
|
352
|
-
|
353
|
-
// That is a layout cell
|
354
|
-
cell.type = 6;
|
355
|
-
if ( !groupZero.layoutCell ) {
|
356
|
-
groupZero.layoutCell = [];
|
357
|
-
}
|
358
|
-
groupZero.layoutCell.push( cell );
|
359
|
-
|
360
|
-
j = cell.width - 1;
|
361
|
-
if ( j >= jLen ) {
|
362
|
-
break;
|
363
|
-
}
|
364
|
-
}
|
365
|
-
|
366
|
-
// Check the next row to see if they have a corresponding description cell
|
367
|
-
theadRSNext = theadRowStack[ i + 1 ];
|
368
|
-
theadRSNextCell = theadRSNext ? theadRSNext.cell[ j ] : "";
|
369
|
-
if ( !cell.descCell &&
|
370
|
-
cell.elem.nodeName.toLowerCase() === "th" &&
|
371
|
-
!cell.type &&
|
372
|
-
theadRSNext &&
|
373
|
-
theadRSNext.uid !== cell.uid &&
|
374
|
-
theadRSNextCell &&
|
375
|
-
!theadRSNextCell.type &&
|
376
|
-
theadRSNextCell.elem.nodeName.toLowerCase() === "td" &&
|
377
|
-
theadRSNextCell.width === cell.width &&
|
378
|
-
theadRSNextCell.height === 1 ) {
|
379
|
-
|
380
|
-
// Mark the next row as a row description
|
381
|
-
theadRSNext.type = 5;
|
382
|
-
|
383
|
-
// Mark the cell as a cell description
|
384
|
-
theadRSNextCell.type = 5;
|
385
|
-
theadRSNextCell.row = theadRS;
|
386
|
-
cell.descCell = theadRSNextCell;
|
387
|
-
|
388
|
-
// Add the description cell to the complete listing
|
389
|
-
if ( !groupZero.desccell ) {
|
390
|
-
groupZero.desccell = [];
|
391
|
-
}
|
392
|
-
groupZero.desccell.push( theadRSNextCell );
|
393
|
-
|
394
|
-
j = cell.width - 1;
|
395
|
-
if ( j >= jLen ) {
|
396
|
-
break;
|
397
|
-
}
|
398
|
-
}
|
399
|
-
|
400
|
-
if ( !cell.type ) {
|
401
|
-
cell.type = 1;
|
402
|
-
}
|
403
|
-
}
|
404
|
-
}
|
405
|
-
|
406
|
-
// Clean the theadRowStack by removing any descriptive row
|
407
|
-
for ( i = 0, iLen = theadRowStack.length; i !== iLen; i += 1 ) {
|
408
|
-
theadRS = theadRowStack[ i ];
|
409
|
-
if ( theadRS.type === 5 ) {
|
410
|
-
|
411
|
-
// Check if all the cell in it are set to the type 5
|
412
|
-
for ( j = 0, jLen = theadRS.cell.length; j !== jLen; j += 1 ) {
|
413
|
-
cell = theadRS.cell[ j ];
|
414
|
-
if ( cell.type !== 5 && cell.type !== 6 && cell.height === 1 ) {
|
415
|
-
$obj.trigger( {
|
416
|
-
type: warningEvent,
|
417
|
-
pointer: cell.elem,
|
418
|
-
err: 4
|
419
|
-
} );
|
420
|
-
}
|
421
|
-
|
422
|
-
// Check the row before and modify their height value
|
423
|
-
if ( cell.uid === theadRowStack[ i - 1 ].cell[ j ].uid ) {
|
424
|
-
cell.height -= 1;
|
425
|
-
}
|
426
|
-
}
|
427
|
-
groupZero.nbDescriptionRow += 1;
|
428
|
-
} else {
|
429
|
-
tmpStack.push( theadRS );
|
430
|
-
}
|
431
|
-
}
|
432
|
-
|
433
|
-
// Array based on level as indexes for columns and group headers
|
434
|
-
groupZero.colgrp = [];
|
435
|
-
|
436
|
-
// Parser any cell in the colgroup header
|
437
|
-
if ( colgroupHeaderColEnd > 0 &&
|
438
|
-
( colgroupFrame.length === 1 || colgroupFrame.length === 0 ) ) {
|
439
|
-
|
440
|
-
// There are no colgroup elements defined.
|
441
|
-
// All cells will be considered to be a data cells.
|
442
|
-
// Data Colgroup
|
443
|
-
dataColgroup = {};
|
444
|
-
dataColumns = [];
|
445
|
-
colgroup = {
|
446
|
-
start: ( colgroupHeaderColEnd + 1 ),
|
447
|
-
end: tableCellWidth,
|
448
|
-
col: [],
|
449
|
-
groupZero: groupZero,
|
450
|
-
elem: undefined,
|
451
|
-
|
452
|
-
// Set colgroup data type
|
453
|
-
type: 2
|
454
|
-
};
|
455
|
-
colgroup.uid = uidElem;
|
456
|
-
uidElem += 1;
|
457
|
-
groupZero.allParserObj.push( colgroup );
|
458
|
-
|
459
|
-
if ( colgroup.start > colgroup.end ) {
|
460
|
-
$obj.trigger( {
|
461
|
-
type: warningEvent,
|
462
|
-
pointer: $obj,
|
463
|
-
err: 5
|
464
|
-
} );
|
465
|
-
}
|
466
|
-
|
467
|
-
dataColgroup = colgroup;
|
468
|
-
|
469
|
-
// Create the column
|
470
|
-
// Create virtual column
|
471
|
-
for ( i = colgroup.start, iLen = colgroup.end; i <= iLen; i += 1 ) {
|
472
|
-
col = {
|
473
|
-
start: 0,
|
474
|
-
end: 0,
|
475
|
-
groupZero: groupZero,
|
476
|
-
elem: undefined
|
477
|
-
};
|
478
|
-
col.uid = uidElem;
|
479
|
-
uidElem += 1;
|
480
|
-
groupZero.allParserObj.push( col );
|
481
|
-
|
482
|
-
if ( !groupZero.col ) {
|
483
|
-
groupZero.col = [];
|
484
|
-
}
|
485
|
-
dataColumns.push( col );
|
486
|
-
|
487
|
-
col.start = i;
|
488
|
-
col.end = i;
|
489
|
-
col.groupstruct = colgroup;
|
490
|
-
|
491
|
-
colgroup.col.push( col );
|
492
|
-
|
493
|
-
// Check to remove "columnFrame"
|
494
|
-
columnFrame.push( col );
|
495
|
-
}
|
496
|
-
|
497
|
-
// Default Level => 1
|
498
|
-
groupZero.colgrp[ 1 ] = [];
|
499
|
-
groupZero.colgrp[ 1 ].push( groupZero.colcaption );
|
500
|
-
|
501
|
-
// Header Colgroup
|
502
|
-
if ( colgroupHeaderColEnd > 0 ) {
|
503
|
-
hcolgroup = {
|
504
|
-
start: 1,
|
505
|
-
elem: undefined,
|
506
|
-
end: colgroupHeaderColEnd,
|
507
|
-
col: [],
|
508
|
-
groupZero: groupZero,
|
509
|
-
|
510
|
-
// Set colgroup data type
|
511
|
-
type: 1
|
512
|
-
};
|
513
|
-
hcolgroup.uid = uidElem;
|
514
|
-
uidElem += 1;
|
515
|
-
groupZero.allParserObj.push( hcolgroup );
|
516
|
-
|
517
|
-
colgroupFrame.push( hcolgroup );
|
518
|
-
colgroupFrame.push( dataColgroup );
|
519
|
-
groupZero.colcaption.dataset = dataColgroup.col;
|
520
|
-
|
521
|
-
// Create the column
|
522
|
-
// Create virtual column
|
523
|
-
for ( i = hcolgroup.start, iLen = hcolgroup.end; i <= iLen; i += 1 ) {
|
524
|
-
col = {
|
525
|
-
start: 0,
|
526
|
-
end: 0,
|
527
|
-
groupZero: groupZero,
|
528
|
-
elem: undefined
|
529
|
-
};
|
530
|
-
col.uid = uidElem;
|
531
|
-
uidElem += 1;
|
532
|
-
groupZero.allParserObj.push( col );
|
533
|
-
|
534
|
-
if ( !groupZero.col ) {
|
535
|
-
groupZero.col = [];
|
536
|
-
}
|
537
|
-
groupZero.col.push( col );
|
538
|
-
|
539
|
-
col.start = i;
|
540
|
-
col.end = i;
|
541
|
-
col.groupstruct = hcolgroup;
|
542
|
-
|
543
|
-
hcolgroup.col.push( col );
|
544
|
-
columnFrame.push( col );
|
545
|
-
}
|
546
|
-
|
547
|
-
for ( i = 0, iLen = dataColumns.length; i !== iLen; i += 1 ) {
|
548
|
-
groupZero.col.push( dataColumns[ i ] );
|
549
|
-
}
|
550
|
-
}
|
551
|
-
|
552
|
-
if ( colgroupFrame.length === 0 ) {
|
553
|
-
colgroupFrame.push( dataColgroup );
|
554
|
-
groupZero.colcaption.dataset = dataColgroup.col;
|
555
|
-
}
|
556
|
-
|
557
|
-
// Set the header for each column
|
558
|
-
for ( i = 0, iLen = groupZero.col.length; i !== iLen; i += 1 ) {
|
559
|
-
gzCol = groupZero.col[ i ];
|
560
|
-
gzCol.header = [];
|
561
|
-
for ( j = 0, jLen = tmpStack.length; j !== jLen; j += 1 ) {
|
562
|
-
for ( m = gzCol.start, mLen = gzCol.end; m <= mLen; m += 1 ) {
|
563
|
-
cell = tmpStack[ j ].cell[ m - 1 ];
|
564
|
-
if ( ( j === 0 || ( j > 0 &&
|
565
|
-
cell.uid !== tmpStack[ j - 1 ].cell[ m - 1 ].uid ) ) &&
|
566
|
-
cell.type === 1 ) {
|
567
|
-
|
568
|
-
gzCol.header.push( cell );
|
569
|
-
}
|
570
|
-
}
|
571
|
-
}
|
572
|
-
}
|
573
|
-
} else {
|
574
|
-
|
575
|
-
// They exist colgroup element,
|
576
|
-
//
|
577
|
-
// -----------------------------------------------------
|
578
|
-
//
|
579
|
-
// Build data column group based on the data column group and summary column group.
|
580
|
-
//
|
581
|
-
// Suggestion: In the future, may be allow the use of a HTML5 data or CSS Option to force a colgroup to be a data group instead of a summary group
|
582
|
-
//
|
583
|
-
// -----------------------------------------------------
|
584
|
-
//
|
585
|
-
// List of real colgroup
|
586
|
-
currColPos = (
|
587
|
-
colgroupHeaderColEnd === 0 ?
|
588
|
-
1 :
|
589
|
-
|
590
|
-
// Set the current column position
|
591
|
-
colgroupFrame[ 0 ].end + 1
|
592
|
-
);
|
593
|
-
|
594
|
-
colgroup = {
|
595
|
-
start: currColPos,
|
596
|
-
end: undefined,
|
597
|
-
col: [],
|
598
|
-
row: [],
|
599
|
-
|
600
|
-
// Set colgroup data type, that is the initial colgroup type
|
601
|
-
type: 2
|
602
|
-
};
|
603
|
-
currColgroupStructure = [];
|
604
|
-
bigTotalColgroupFound = false;
|
605
|
-
|
606
|
-
$.each( colgroupFrame, function() {
|
607
|
-
var curColgroupFrame = this,
|
608
|
-
groupLevel,
|
609
|
-
cgrp,
|
610
|
-
parentHeader,
|
611
|
-
summaryAttached;
|
612
|
-
|
613
|
-
if ( bigTotalColgroupFound || groupZero.colgrp[ 0 ] ) {
|
614
|
-
$obj.trigger( {
|
615
|
-
type: errorEvent,
|
616
|
-
pointer: curColgroupFrame,
|
617
|
-
err: 6
|
618
|
-
} );
|
619
|
-
return;
|
620
|
-
}
|
621
|
-
|
622
|
-
$.each( curColgroupFrame.col, function() {
|
623
|
-
var column = this;
|
624
|
-
if ( !groupZero.col ) {
|
625
|
-
groupZero.col = [];
|
626
|
-
}
|
627
|
-
groupZero.col.push( column );
|
628
|
-
|
629
|
-
column.type = 1;
|
630
|
-
column.groupstruct = curColgroupFrame;
|
631
|
-
} );
|
632
|
-
|
633
|
-
if ( curColgroupFrame.start < currColPos ) {
|
634
|
-
if ( colgroupHeaderColEnd !== curColgroupFrame.end ) {
|
635
|
-
$obj.trigger( {
|
636
|
-
type: warningEvent,
|
637
|
-
pointer: curColgroupFrame,
|
638
|
-
err: 7
|
639
|
-
} );
|
640
|
-
}
|
641
|
-
|
642
|
-
// Skip this colgroup, this should happened only once and should represent the header colgroup
|
643
|
-
|
644
|
-
// Assign the headers for this group
|
645
|
-
for ( i = 0, iLen = curColgroupFrame.col.length; i !== iLen; i += 1 ) {
|
646
|
-
gzCol = curColgroupFrame.col[ i ];
|
647
|
-
gzCol.header = [];
|
648
|
-
for ( j = 0, jLen = tmpStack.length; j !== jLen; j += 1 ) {
|
649
|
-
for ( m = gzCol.start, mLen = gzCol.end; m <= mLen; m += 1 ) {
|
650
|
-
if ( ( j === 0 || ( j > 0 &&
|
651
|
-
tmpStack[ j ].cell[ m - 1 ].uid !== tmpStack[ j - 1 ].cell[ m - 1 ].uid ) ) &&
|
652
|
-
tmpStack[ j ].cell[ m - 1 ].type === 1 ) {
|
653
|
-
gzCol.header.push( tmpStack[ j ].cell[ m - 1 ] );
|
654
|
-
}
|
655
|
-
}
|
656
|
-
}
|
657
|
-
}
|
658
|
-
|
659
|
-
return;
|
660
|
-
}
|
661
|
-
|
662
|
-
groupLevel = undefined;
|
663
|
-
|
664
|
-
// Get the colgroup level
|
665
|
-
for ( i = 0, iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
666
|
-
tmpStackCell = tmpStack[ i ].cell[ curColgroupFrame.end - 1 ];
|
667
|
-
if ( !tmpStackCell && curColgroupFrame.end > tmpStack[ i ].cell.length ) {
|
668
|
-
|
669
|
-
// Number of column are not corresponding to the table width
|
670
|
-
$obj.trigger( {
|
671
|
-
type: warningEvent,
|
672
|
-
pointer: $obj,
|
673
|
-
err: 3
|
674
|
-
} );
|
675
|
-
break;
|
676
|
-
}
|
677
|
-
if ( ( tmpStackCell.colpos + tmpStackCell.width - 1 ) === curColgroupFrame.end &&
|
678
|
-
( tmpStackCell.colpos >= curColgroupFrame.start ) ) {
|
679
|
-
|
680
|
-
if ( !groupLevel || groupLevel > ( i + 1 ) ) {
|
681
|
-
|
682
|
-
// would equal at the current data cell level.
|
683
|
-
// The lowest row level wins.
|
684
|
-
groupLevel = ( i + 1 );
|
685
|
-
}
|
686
|
-
}
|
687
|
-
}
|
688
|
-
|
689
|
-
if ( !groupLevel ) {
|
690
|
-
|
691
|
-
// Default colgroup data Level, this happen when there
|
692
|
-
// is no column header (same as no thead).
|
693
|
-
groupLevel = 1;
|
694
|
-
}
|
695
|
-
|
696
|
-
// All the cells at higher level (below the group level found)
|
697
|
-
// of which one found, need to be inside the colgroup
|
698
|
-
for ( i = ( groupLevel - 1 ), iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
699
|
-
tmpStackCurr = tmpStack[ i ];
|
700
|
-
|
701
|
-
// Test each cell in that group
|
702
|
-
for ( j = curColgroupFrame.start - 1, jLen = curColgroupFrame.end; j !== jLen; j += 1 ) {
|
703
|
-
tmpStackCell = tmpStackCurr.cell[ j ];
|
704
|
-
if ( tmpStackCell.colpos < curColgroupFrame.start ||
|
705
|
-
( tmpStackCell.colpos + tmpStackCell.width - 1 ) > curColgroupFrame.end ) {
|
706
|
-
|
707
|
-
$obj.trigger( {
|
708
|
-
type: errorEvent,
|
709
|
-
pointer: $obj,
|
710
|
-
err: 9
|
711
|
-
} );
|
712
|
-
return;
|
713
|
-
}
|
714
|
-
}
|
715
|
-
}
|
716
|
-
|
717
|
-
// Add virtual colgroup Based on the top header
|
718
|
-
for ( i = currColgroupStructure.length, iLen = ( groupLevel - 1 ); i !== iLen; i += 1 ) {
|
719
|
-
tmpStackCell = tmpStack[ i ].cell[ curColgroupFrame.start - 1 ];
|
720
|
-
|
721
|
-
// Use the top cell at level minus 1, that cell must be larger
|
722
|
-
if ( tmpStackCell.uid !== tmpStack[ i ].cell[ curColgroupFrame.end - 1 ].uid ||
|
723
|
-
tmpStackCell.colpos > curColgroupFrame.start ||
|
724
|
-
tmpStackCell.colpos + tmpStackCell.width - 1 < curColgroupFrame.end ) {
|
725
|
-
$obj.trigger( {
|
726
|
-
type: errorEvent,
|
727
|
-
pointer: $obj,
|
728
|
-
err: 10
|
729
|
-
} );
|
730
|
-
return;
|
731
|
-
}
|
732
|
-
|
733
|
-
// Convert the header in a group header cell
|
734
|
-
cgrp = tmpStackCell;
|
735
|
-
cgrp.level = i + 1;
|
736
|
-
|
737
|
-
cgrp.start = cgrp.colpos;
|
738
|
-
cgrp.end = cgrp.colpos + cgrp.width - 1;
|
739
|
-
|
740
|
-
// Group header cell
|
741
|
-
cgrp.type = 7;
|
742
|
-
|
743
|
-
currColgroupStructure.push( cgrp );
|
744
|
-
|
745
|
-
if ( !groupZero.virtualColgroup ) {
|
746
|
-
groupZero.virtualColgroup = [];
|
747
|
-
}
|
748
|
-
groupZero.virtualColgroup.push( cgrp );
|
749
|
-
|
750
|
-
// Add the group into the level colgroup perspective
|
751
|
-
if ( !groupZero.colgrp[ i + 1 ] ) {
|
752
|
-
groupZero.colgrp[ i + 1 ] = [];
|
753
|
-
}
|
754
|
-
groupZero.colgrp[ i + 1 ].push( cgrp );
|
755
|
-
}
|
756
|
-
|
757
|
-
// Set the header list for the current group
|
758
|
-
curColgroupFrame.header = [];
|
759
|
-
for ( i = groupLevel - ( groupLevel >= 2 ? 2 : 1 ), iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
760
|
-
for ( j = curColgroupFrame.start; j <= curColgroupFrame.end; j += 1 ) {
|
761
|
-
if ( tmpStack[ i ].cell[ j - 1 ].rowpos === i + 1 ) {
|
762
|
-
curColgroupFrame.header.push( tmpStack[ i ].cell[ j - 1 ] );
|
763
|
-
|
764
|
-
// Attach the current colgroup to this header
|
765
|
-
tmpStack[ i ].cell[ j - 1 ].colgroup = curColgroupFrame;
|
766
|
-
}
|
767
|
-
j += tmpStack[ i ].cell[ j - 1 ].width - 1;
|
768
|
-
}
|
769
|
-
}
|
770
|
-
|
771
|
-
// Assign the parent header to the current header
|
772
|
-
parentHeader = [];
|
773
|
-
for ( i = 0; i < currColgroupStructure.length - 1; i += 1 ) {
|
774
|
-
parentHeader.push( currColgroupStructure[ i ] );
|
775
|
-
}
|
776
|
-
curColgroupFrame.parentHeader = parentHeader;
|
777
|
-
|
778
|
-
// Check to set if this group are a data group
|
779
|
-
if ( currColgroupStructure.length < groupLevel ) {
|
780
|
-
|
781
|
-
// This colgroup are a data colgroup
|
782
|
-
// The current colgroup are a data colgroup
|
783
|
-
if ( !curColgroupFrame.type ) {
|
784
|
-
curColgroupFrame.type = 2;
|
785
|
-
|
786
|
-
// Set Data group type
|
787
|
-
curColgroupFrame.level = groupLevel;
|
788
|
-
}
|
789
|
-
|
790
|
-
currColgroupStructure.push( curColgroupFrame );
|
791
|
-
|
792
|
-
// Add the group into the level colgroup perspective
|
793
|
-
if ( !groupZero.colgrp[ groupLevel ] ) {
|
794
|
-
groupZero.colgrp[ groupLevel ] = [];
|
795
|
-
}
|
796
|
-
groupZero.colgrp[ groupLevel ].push( curColgroupFrame );
|
797
|
-
}
|
798
|
-
|
799
|
-
//
|
800
|
-
// Preparing the current stack for the next colgroup and set if the current are a summary group
|
801
|
-
//
|
802
|
-
|
803
|
-
// Check if we need to pop out the current header colgroup
|
804
|
-
summaryAttached = false;
|
805
|
-
for ( i = currColgroupStructure.length - 1; i !== -1; i -= 1 ) {
|
806
|
-
|
807
|
-
if ( currColgroupStructure[ i ].end <= curColgroupFrame.end ) {
|
808
|
-
|
809
|
-
if ( currColgroupStructure[ i ].level < groupLevel && theadRowStack.length > 0 ) {
|
810
|
-
curColgroupFrame.type = 3;
|
811
|
-
}
|
812
|
-
|
813
|
-
// Attach the Summary group to the colgroup
|
814
|
-
// popped if current colgroup are type 3
|
815
|
-
if ( curColgroupFrame.type === 3 && !summaryAttached ) {
|
816
|
-
currColgroupStructure[ currColgroupStructure.length - 1 ].summary = curColgroupFrame;
|
817
|
-
|
818
|
-
// This are used to do not attach a summary of level 4
|
819
|
-
// to an inappropriate level 1 for example
|
820
|
-
summaryAttached = true;
|
821
|
-
}
|
822
|
-
|
823
|
-
currColgroupStructure.pop();
|
824
|
-
}
|
825
|
-
}
|
826
|
-
|
827
|
-
if ( !hassumMode ) {
|
828
|
-
curColgroupFrame.type = 2;
|
829
|
-
}
|
830
|
-
|
831
|
-
// Catch the second and the third possible grouping at level 1
|
832
|
-
if ( groupLevel === 1 && groupZero.colgrp[ 1 ] &&
|
833
|
-
groupZero.colgrp[ 1 ].length > 1 && theadRowStack.length > 0 ) {
|
834
|
-
|
835
|
-
// Check if in the group at level 1 if
|
836
|
-
// we don't already have a summary colgroup
|
837
|
-
for ( i = 0; i < groupZero.colgrp[ 1 ].length; i += 1 ) {
|
838
|
-
if ( groupZero.colgrp[ 1 ][ i ].type === 3 ) {
|
839
|
-
|
840
|
-
// Congrats, we found the last possible colgroup,
|
841
|
-
curColgroupFrame.level = 0;
|
842
|
-
if ( !groupZero.colgrp[ 0 ] ) {
|
843
|
-
groupZero.colgrp[ 0 ] = [];
|
844
|
-
}
|
845
|
-
groupZero.colgrp[ 0 ].push( curColgroupFrame );
|
846
|
-
groupZero.colgrp[ 1 ].pop();
|
847
|
-
|
848
|
-
bigTotalColgroupFound = true;
|
849
|
-
break;
|
850
|
-
}
|
851
|
-
}
|
852
|
-
if ( hassumMode ) {
|
853
|
-
curColgroupFrame.type = 3;
|
854
|
-
}
|
855
|
-
}
|
856
|
-
|
857
|
-
// Set the representative header "caption" element for a group at level 0
|
858
|
-
if ( curColgroupFrame.level === 1 && curColgroupFrame.type === 2 ) {
|
859
|
-
curColgroupFrame.repheader = "caption";
|
860
|
-
}
|
861
|
-
|
862
|
-
if ( !groupZero.col ) {
|
863
|
-
groupZero.col = [];
|
864
|
-
}
|
865
|
-
|
866
|
-
$.each( curColgroupFrame.col, function() {
|
867
|
-
var column = this,
|
868
|
-
colStart = column.start,
|
869
|
-
colEnd = column.end,
|
870
|
-
colpos, cellWidth, cell, colHeaderLen;
|
871
|
-
|
872
|
-
column.type = curColgroupFrame.type;
|
873
|
-
column.level = curColgroupFrame.level;
|
874
|
-
column.groupstruct = curColgroupFrame;
|
875
|
-
|
876
|
-
column.header = [];
|
877
|
-
|
878
|
-
// Find the lowest header that would represent this column
|
879
|
-
for ( j = ( groupLevel - 1 ); j < tmpStack.length; j += 1 ) {
|
880
|
-
for ( i = ( curColgroupFrame.start - 1 ); i < curColgroupFrame.end; i += 1 ) {
|
881
|
-
cell = tmpStack[ j ].cell[ i ];
|
882
|
-
colpos = cell.colpos;
|
883
|
-
cellWidth = cell.width - 1;
|
884
|
-
if ( ( colpos >= colStart && colpos <= colEnd ) ||
|
885
|
-
( colpos <= colStart &&
|
886
|
-
( colpos + cellWidth ) >= colEnd ) ||
|
887
|
-
( ( colpos + cellWidth ) <= colStart &&
|
888
|
-
( colpos + cellWidth ) >= colEnd ) ) {
|
889
|
-
|
890
|
-
colHeaderLen = column.header.length;
|
891
|
-
if ( colHeaderLen === 0 || ( colHeaderLen > 0 && column.header[ colHeaderLen - 1 ].uid !== cell.uid ) ) {
|
892
|
-
|
893
|
-
// This are the header that would represent this column
|
894
|
-
column.header.push( cell );
|
895
|
-
tmpStack[ j ].cell[ i ].level = curColgroupFrame.level;
|
896
|
-
}
|
897
|
-
}
|
898
|
-
}
|
899
|
-
}
|
900
|
-
} );
|
901
|
-
} );
|
902
|
-
|
903
|
-
if ( !groupZero.virtualColgroup ) {
|
904
|
-
groupZero.virtualColgroup = [];
|
905
|
-
}
|
906
|
-
|
907
|
-
// Set the Virtual Group Header Cell, if any
|
908
|
-
$.each( groupZero.virtualColgroup, function() {
|
909
|
-
var vGroupHeaderCell = this;
|
910
|
-
|
911
|
-
// Set the headerLevel at the appropriate column
|
912
|
-
for ( i = ( vGroupHeaderCell.start - 1 ); i < vGroupHeaderCell.end; i += 1 ) {
|
913
|
-
if ( !groupZero.col[ i ].headerLevel ) {
|
914
|
-
groupZero.col[ i ].headerLevel = [];
|
915
|
-
}
|
916
|
-
groupZero.col[ i ].headerLevel.push( vGroupHeaderCell );
|
917
|
-
}
|
918
|
-
} );
|
919
|
-
}
|
920
|
-
|
921
|
-
// Associate the colgroup Header in the group Zero
|
922
|
-
if ( colgroupFrame.length > 0 && colgroupHeaderColEnd > 0 ) {
|
923
|
-
groupZero.colgrouphead = colgroupFrame[ 0 ];
|
924
|
-
|
925
|
-
// Set the first colgroup type :-)
|
926
|
-
groupZero.colgrouphead.type = 1;
|
927
|
-
}
|
928
|
-
}
|
929
|
-
|
930
|
-
function finalizeRowGroup() {
|
931
|
-
|
932
|
-
// Check if the current rowgroup has been go in the rowgroup setup, if not we do
|
933
|
-
if ( !currentRowGroup.type || !currentRowGroup.level ) {
|
934
|
-
|
935
|
-
// Colgroup Setup,
|
936
|
-
rowgroupSetup();
|
937
|
-
}
|
938
|
-
|
939
|
-
// If the current row group are a data group, check each row if we can found a pattern about to increment the data level for this row group
|
940
|
-
// Update, if needed, each row and cell to take in consideration the new row group level
|
941
|
-
// Add the row group in the groupZero Collection
|
942
|
-
lstRowGroup.push( currentRowGroup );
|
943
|
-
currentRowGroup = {};
|
944
|
-
}
|
945
|
-
|
946
|
-
function initiateRowGroup() {
|
947
|
-
|
948
|
-
// Finalisation of any existing row group
|
949
|
-
if ( currentRowGroup && currentRowGroup.type ) {
|
950
|
-
finalizeRowGroup();
|
951
|
-
}
|
952
|
-
|
953
|
-
// Initialisation of the a new row group
|
954
|
-
currentRowGroup = {};
|
955
|
-
currentRowGroup.elem = currentRowGroupElement;
|
956
|
-
currentRowGroup.row = [];
|
957
|
-
currentRowGroup.headerlevel = [];
|
958
|
-
currentRowGroup.groupZero = groupZero;
|
959
|
-
currentRowGroup.uid = uidElem;
|
960
|
-
uidElem += 1;
|
961
|
-
}
|
962
|
-
|
963
|
-
function rowgroupSetup( forceDataGroup ) {
|
964
|
-
|
965
|
-
var i, iLen, previousRowGroup, tmpHeaderLevel;
|
966
|
-
|
967
|
-
if ( tfootOnProcess ) {
|
968
|
-
currentRowGroup.type = 3;
|
969
|
-
currentRowGroup.level = 0;
|
970
|
-
rowgroupHeaderRowStack = [];
|
971
|
-
return;
|
972
|
-
}
|
973
|
-
|
974
|
-
// Check if the current row group, already have some row,
|
975
|
-
// if yes this is a new row group
|
976
|
-
if ( rowgroupHeaderRowStack.length !== 0 ) {
|
977
|
-
|
978
|
-
// if more than 0 cell in the stack, mark this row group as a data
|
979
|
-
// row group and create the new row group (can be only virtual)
|
980
|
-
if ( currentRowGroup && currentRowGroup.type &&
|
981
|
-
currentRowGroup.row.length > 0 ) {
|
982
|
-
|
983
|
-
currentRowGroupElement = {};
|
984
|
-
initiateRowGroup();
|
985
|
-
}
|
986
|
-
|
987
|
-
// We have a data row group
|
988
|
-
currentRowGroup.type = 2;
|
989
|
-
|
990
|
-
// Set the group header cell
|
991
|
-
currentRowGroup.row = rowgroupHeaderRowStack;
|
992
|
-
for ( i = 0, iLen = rowgroupHeaderRowStack.length; i !== iLen; i += 1 ) {
|
993
|
-
rowgroupHeaderRowStack[ i ].cell[ 0 ].type = 7;
|
994
|
-
rowgroupHeaderRowStack[ i ].cell[ 0 ].scope = "row";
|
995
|
-
rowgroupHeaderRowStack[ i ].cell[ 0 ].row = rowgroupHeaderRowStack[ i ];
|
996
|
-
currentRowGroup.headerlevel.push( rowgroupHeaderRowStack[ i ].cell[ 0 ] );
|
997
|
-
}
|
998
|
-
}
|
999
|
-
|
1000
|
-
// if no cell in the stack but first row group, mark this row group as a data row group
|
1001
|
-
if ( rowgroupHeaderRowStack.length === 0 && lstRowGroup.length === 0 ) {
|
1002
|
-
|
1003
|
-
if ( currentRowGroup.type && currentRowGroup.type === 1 ) {
|
1004
|
-
currentRowGroupElement = {};
|
1005
|
-
initiateRowGroup();
|
1006
|
-
}
|
1007
|
-
|
1008
|
-
// This is the first data row group at level 1
|
1009
|
-
currentRowGroup.type = 2;
|
1010
|
-
|
1011
|
-
// Default row group level
|
1012
|
-
currentRowGroup.level = 1;
|
1013
|
-
}
|
1014
|
-
|
1015
|
-
// if no cell in the stack and not the first row group, this are a summary group
|
1016
|
-
// This is only valid if the first colgroup is a header colgroup.
|
1017
|
-
if ( rowgroupHeaderRowStack.length === 0 && lstRowGroup.length > 0 &&
|
1018
|
-
!currentRowGroup.type && colgroupFrame[ 0 ] &&
|
1019
|
-
( colgroupFrame[ 0 ].type === 1 || ( !colgroupFrame[ 0 ].type && colgroupFrame.length > 0 ) ) &&
|
1020
|
-
!forceDataGroup ) {
|
1021
|
-
|
1022
|
-
currentRowGroup.type = 3;
|
1023
|
-
} else {
|
1024
|
-
currentRowGroup.type = 2;
|
1025
|
-
}
|
1026
|
-
|
1027
|
-
if ( currentRowGroup.type === 3 && !hassumMode ) {
|
1028
|
-
currentRowGroup.type = 2;
|
1029
|
-
currentRowGroup.level = lstRowGroup[ lstRowGroup.length - 1 ].level;
|
1030
|
-
}
|
1031
|
-
|
1032
|
-
// Set the Data Level for this row group
|
1033
|
-
// Calculate the appropriate row group level based on the previous rowgroup
|
1034
|
-
// * a Summary Group decrease the row group level
|
1035
|
-
// * a Data Group increase the row group level based of his number of row group header and the previous row group level
|
1036
|
-
// * Dont forget to set the appropriate level to each group header cell inside this row group.
|
1037
|
-
if ( !currentRowGroup.level ) {
|
1038
|
-
|
1039
|
-
// Get the level of the previous group
|
1040
|
-
if ( lstRowGroup.length > 0 ) {
|
1041
|
-
previousRowGroup = lstRowGroup[ lstRowGroup.length - 1 ];
|
1042
|
-
|
1043
|
-
if ( currentRowGroup.type === 2 ) {
|
1044
|
-
|
1045
|
-
// Data Group
|
1046
|
-
if ( currentRowGroup.headerlevel.length === previousRowGroup.headerlevel.length ) {
|
1047
|
-
|
1048
|
-
// Same Level as the previous one
|
1049
|
-
currentRowGroup.level = previousRowGroup.level;
|
1050
|
-
} else if ( currentRowGroup.headerlevel.length < previousRowGroup.headerlevel.length ) {
|
1051
|
-
|
1052
|
-
// add the missing group heading cell
|
1053
|
-
tmpHeaderLevel = currentRowGroup.headerlevel;
|
1054
|
-
currentRowGroup.headerlevel = [];
|
1055
|
-
|
1056
|
-
for ( i = 0; i < ( previousRowGroup.headerlevel.length - currentRowGroup.headerlevel.length ); i += 1 ) {
|
1057
|
-
currentRowGroup.headerlevel.push( previousRowGroup.headerlevel[ i ] );
|
1058
|
-
}
|
1059
|
-
for ( i = 0; i < tmpHeaderLevel.length; i += 1 ) {
|
1060
|
-
currentRowGroup.headerlevel.push( tmpHeaderLevel[ i ] );
|
1061
|
-
}
|
1062
|
-
currentRowGroup.level = previousRowGroup.level;
|
1063
|
-
} else if ( currentRowGroup.headerlevel.length > previousRowGroup.headerlevel.length ) {
|
1064
|
-
|
1065
|
-
// This are a new set of heading, the level equal the number of group header cell found
|
1066
|
-
currentRowGroup.level = currentRowGroup.headerlevel.length + 1;
|
1067
|
-
}
|
1068
|
-
} else if ( currentRowGroup.type === 3 ) {
|
1069
|
-
|
1070
|
-
// Summary Group
|
1071
|
-
if ( previousRowGroup.type === 3 ) {
|
1072
|
-
currentRowGroup.level = previousRowGroup.level - 1;
|
1073
|
-
} else {
|
1074
|
-
currentRowGroup.level = previousRowGroup.level;
|
1075
|
-
}
|
1076
|
-
if ( currentRowGroup.level < 0 ) {
|
1077
|
-
|
1078
|
-
// This is an error, Last summary row group was already found.
|
1079
|
-
$obj.trigger( {
|
1080
|
-
type: warningEvent,
|
1081
|
-
pointer: $obj,
|
1082
|
-
err: 12
|
1083
|
-
} );
|
1084
|
-
}
|
1085
|
-
|
1086
|
-
// Set the header level with the previous row group
|
1087
|
-
for ( i = 0; i < previousRowGroup.headerlevel.length; i += 1 ) {
|
1088
|
-
if ( previousRowGroup.headerlevel[ i ].level < currentRowGroup.level ) {
|
1089
|
-
currentRowGroup.headerlevel.push( previousRowGroup.headerlevel[ i ] );
|
1090
|
-
}
|
1091
|
-
}
|
1092
|
-
} else {
|
1093
|
-
|
1094
|
-
// Error
|
1095
|
-
currentRowGroup.level = "Error, not calculated";
|
1096
|
-
$obj.trigger( {
|
1097
|
-
type: warningEvent,
|
1098
|
-
pointer: $obj,
|
1099
|
-
err: 13
|
1100
|
-
} );
|
1101
|
-
}
|
1102
|
-
} else {
|
1103
|
-
currentRowGroup.level = 1 + rowgroupHeaderRowStack.length;
|
1104
|
-
}
|
1105
|
-
}
|
1106
|
-
|
1107
|
-
// Ensure that each row group cell heading have their level set
|
1108
|
-
for ( i = 0; i < currentRowGroup.headerlevel.length; i += 1 ) {
|
1109
|
-
currentRowGroup.headerlevel[ i ].level = i + 1;
|
1110
|
-
currentRowGroup.headerlevel[ i ].rowlevel = currentRowGroup.headerlevel [ i ].level;
|
1111
|
-
}
|
1112
|
-
|
1113
|
-
// reset the row header stack
|
1114
|
-
rowgroupHeaderRowStack = [];
|
1115
|
-
|
1116
|
-
if ( currentRowGroup.level === undefined || currentRowGroup.level < 0 ) {
|
1117
|
-
$obj.trigger( {
|
1118
|
-
type: warningEvent,
|
1119
|
-
pointer: currentRowGroup.elem,
|
1120
|
-
err: 14
|
1121
|
-
} );
|
1122
|
-
}
|
1123
|
-
}
|
1124
|
-
|
1125
|
-
function processRow( elem ) {
|
1126
|
-
|
1127
|
-
// In this function there are a possible confusion about the colgroup variable name used here vs the real colgroup table, In this function the colgroup is used when there are no header cell.
|
1128
|
-
currentRowPos += 1;
|
1129
|
-
var columnPos = 1,
|
1130
|
-
lastCellType = "",
|
1131
|
-
lastHeadingColPos = false,
|
1132
|
-
cells = $( elem ).children(),
|
1133
|
-
row = {
|
1134
|
-
colgroup: [], /* === Build from colgroup object == */
|
1135
|
-
cell: [], /* === Build from Cell Object == */
|
1136
|
-
elem: elem, /* Row Structure jQuery element */
|
1137
|
-
rowpos: currentRowPos
|
1138
|
-
},
|
1139
|
-
colgroup,
|
1140
|
-
fnPreProcessGroupHeaderCell,
|
1141
|
-
fnPreProcessGroupDataCell,
|
1142
|
-
fnParseSpannedRowCell,
|
1143
|
-
headingRowCell,
|
1144
|
-
rowheader,
|
1145
|
-
colKeyCell,
|
1146
|
-
i,
|
1147
|
-
j,
|
1148
|
-
isDataColgroupType;
|
1149
|
-
|
1150
|
-
$( elem ).data().tblparser = row;
|
1151
|
-
|
1152
|
-
row.uid = uidElem;
|
1153
|
-
uidElem += 1;
|
1154
|
-
row.groupZero = groupZero;
|
1155
|
-
groupZero.allParserObj.push( row );
|
1156
|
-
|
1157
|
-
colgroup = {
|
1158
|
-
cell: [],
|
1159
|
-
cgsummary: undefined, /* ?? Not sure because this will be better in the data colgroup object ?? Summary Colgroup Associated */
|
1160
|
-
type: false /* 1 === header, 2 === data, 3 === summary, 4 === key, 5 === description, 6 === layout, 7 === group header */
|
1161
|
-
};
|
1162
|
-
|
1163
|
-
colgroup.uid = uidElem;
|
1164
|
-
uidElem += 1;
|
1165
|
-
groupZero.allParserObj.push( colgroup );
|
1166
|
-
|
1167
|
-
fnPreProcessGroupHeaderCell = function( headerCell ) {
|
1168
|
-
if ( !colgroup.type ) {
|
1169
|
-
colgroup.type = 1;
|
1170
|
-
}
|
1171
|
-
if ( colgroup.type !== 1 ) {
|
1172
|
-
|
1173
|
-
// Creation of a new colgroup
|
1174
|
-
// Add the previous colgroup
|
1175
|
-
row.colgroup.push( colgroup );
|
1176
|
-
|
1177
|
-
// Create a new colgroup
|
1178
|
-
colgroup = {
|
1179
|
-
cell: [],
|
1180
|
-
type: 1
|
1181
|
-
};
|
1182
|
-
colgroup.uid = uidElem;
|
1183
|
-
uidElem += 1;
|
1184
|
-
groupZero.allParserObj.push( colgroup );
|
1185
|
-
}
|
1186
|
-
colgroup.cell.push( headerCell );
|
1187
|
-
lastHeadingColPos = headerCell.colpos + headerCell.width - 1;
|
1188
|
-
};
|
1189
|
-
|
1190
|
-
fnPreProcessGroupDataCell = function( dataCell ) {
|
1191
|
-
if ( !colgroup.type ) {
|
1192
|
-
colgroup.type = 2;
|
1193
|
-
}
|
1194
|
-
|
1195
|
-
// Check if we need to create a summary colgroup (Based on the top colgroup definition)
|
1196
|
-
if ( colgroup.type !== 2 ) {
|
1197
|
-
|
1198
|
-
// Creation of a new colgroup
|
1199
|
-
// Add the previous colgroup
|
1200
|
-
row.colgroup.push( colgroup );
|
1201
|
-
|
1202
|
-
// Create a new colgroup
|
1203
|
-
colgroup = {
|
1204
|
-
cell: [],
|
1205
|
-
type: 2
|
1206
|
-
};
|
1207
|
-
colgroup.uid = uidElem;
|
1208
|
-
uidElem += 1;
|
1209
|
-
groupZero.allParserObj.push( colgroup );
|
1210
|
-
}
|
1211
|
-
|
1212
|
-
colgroup.cell.push( dataCell );
|
1213
|
-
};
|
1214
|
-
|
1215
|
-
fnParseSpannedRowCell = function() {
|
1216
|
-
var j,
|
1217
|
-
currCell;
|
1218
|
-
|
1219
|
-
// Check for spanned row
|
1220
|
-
while ( columnPos <= tableCellWidth ) {
|
1221
|
-
if ( !spannedRow[ columnPos ] ) {
|
1222
|
-
break;
|
1223
|
-
}
|
1224
|
-
currCell = spannedRow[ columnPos ];
|
1225
|
-
|
1226
|
-
if ( currCell.spanHeight && currCell.spanHeight > 0 && currCell.colpos === columnPos ) {
|
1227
|
-
if ( currCell.height + currCell.rowpos - currCell.spanHeight !== currentRowPos ) {
|
1228
|
-
break;
|
1229
|
-
}
|
1230
|
-
|
1231
|
-
lastCellType = currCell.elem.nodeName.toLowerCase();
|
1232
|
-
|
1233
|
-
if ( lastCellType === "th" ) {
|
1234
|
-
fnPreProcessGroupHeaderCell( currCell );
|
1235
|
-
} else if ( lastCellType === "td" ) {
|
1236
|
-
fnPreProcessGroupDataCell( currCell );
|
1237
|
-
}
|
1238
|
-
|
1239
|
-
// Adjust the spanned value for the next check
|
1240
|
-
if ( currCell.spanHeight === 1 ) {
|
1241
|
-
delete currCell.spanHeight;
|
1242
|
-
} else {
|
1243
|
-
currCell.spanHeight -= 1;
|
1244
|
-
}
|
1245
|
-
|
1246
|
-
for ( j = 0; j < currCell.width; j += 1 ) {
|
1247
|
-
row.cell.push( currCell );
|
1248
|
-
}
|
1249
|
-
|
1250
|
-
// Increment the column position
|
1251
|
-
columnPos += currCell.width;
|
1252
|
-
} else {
|
1253
|
-
break;
|
1254
|
-
}
|
1255
|
-
}
|
1256
|
-
|
1257
|
-
};
|
1258
|
-
|
1259
|
-
// Read the row
|
1260
|
-
$.each( cells, function() {
|
1261
|
-
var $this = $( this ),
|
1262
|
-
width = $this.attr( "colspan" ) !== undefined ? parseInt( $this.attr( "colspan" ), 10 ) : 1,
|
1263
|
-
height = $this.attr( "rowspan" ) !== undefined ? parseInt( $this.attr( "rowspan" ), 10 ) : 1,
|
1264
|
-
headerCell,
|
1265
|
-
dataCell,
|
1266
|
-
i;
|
1267
|
-
|
1268
|
-
switch ( this.nodeName.toLowerCase() ) {
|
1269
|
-
|
1270
|
-
// cell header
|
1271
|
-
case "th":
|
1272
|
-
|
1273
|
-
// Check for spanned cell between cells
|
1274
|
-
fnParseSpannedRowCell();
|
1275
|
-
|
1276
|
-
headerCell = {
|
1277
|
-
rowpos: currentRowPos,
|
1278
|
-
colpos: columnPos,
|
1279
|
-
width: width,
|
1280
|
-
height: height,
|
1281
|
-
data: [],
|
1282
|
-
summary: [],
|
1283
|
-
elem: this
|
1284
|
-
};
|
1285
|
-
|
1286
|
-
$this.data().tblparser = headerCell;
|
1287
|
-
headerCell.groupZero = groupZero;
|
1288
|
-
|
1289
|
-
headerCell.uid = uidElem;
|
1290
|
-
uidElem += 1;
|
1291
|
-
groupZero.allParserObj.push( headerCell );
|
1292
|
-
|
1293
|
-
fnPreProcessGroupHeaderCell( headerCell );
|
1294
|
-
|
1295
|
-
headerCell.parent = colgroup;
|
1296
|
-
|
1297
|
-
headerCell.spanHeight = height - 1;
|
1298
|
-
|
1299
|
-
for ( i = 0; i < width; i += 1 ) {
|
1300
|
-
row.cell.push( headerCell );
|
1301
|
-
spannedRow[ columnPos + i ] = headerCell;
|
1302
|
-
}
|
1303
|
-
|
1304
|
-
// Increment the column position
|
1305
|
-
columnPos += headerCell.width;
|
1306
|
-
|
1307
|
-
break;
|
1308
|
-
|
1309
|
-
// data cell
|
1310
|
-
case "td":
|
1311
|
-
|
1312
|
-
// Check for spanned cell between cells
|
1313
|
-
fnParseSpannedRowCell();
|
1314
|
-
|
1315
|
-
dataCell = {
|
1316
|
-
rowpos: currentRowPos,
|
1317
|
-
colpos: columnPos,
|
1318
|
-
width: width,
|
1319
|
-
height: height,
|
1320
|
-
elem: this
|
1321
|
-
};
|
1322
|
-
|
1323
|
-
$this.data().tblparser = dataCell;
|
1324
|
-
dataCell.groupZero = groupZero;
|
1325
|
-
|
1326
|
-
dataCell.uid = uidElem;
|
1327
|
-
uidElem += 1;
|
1328
|
-
groupZero.allParserObj.push( dataCell );
|
1329
|
-
|
1330
|
-
fnPreProcessGroupDataCell( dataCell );
|
1331
|
-
|
1332
|
-
dataCell.parent = colgroup;
|
1333
|
-
|
1334
|
-
dataCell.spanHeight = height - 1;
|
1335
|
-
|
1336
|
-
for ( i = 0; i < width; i += 1 ) {
|
1337
|
-
row.cell.push( dataCell );
|
1338
|
-
spannedRow[ columnPos + i ] = dataCell;
|
1339
|
-
}
|
1340
|
-
|
1341
|
-
// Increment the column position
|
1342
|
-
columnPos += dataCell.width;
|
1343
|
-
|
1344
|
-
break;
|
1345
|
-
default:
|
1346
|
-
$obj.trigger( {
|
1347
|
-
type: warningEvent,
|
1348
|
-
pointer: this,
|
1349
|
-
err: 15
|
1350
|
-
} );
|
1351
|
-
break;
|
1352
|
-
}
|
1353
|
-
|
1354
|
-
lastCellType = this.nodeName.toLowerCase();
|
1355
|
-
|
1356
|
-
} );
|
1357
|
-
|
1358
|
-
// Check for any spanned cell
|
1359
|
-
fnParseSpannedRowCell();
|
1360
|
-
|
1361
|
-
// Check if this the number of column for this row are equal to the other
|
1362
|
-
if ( tableCellWidth === 0 ) {
|
1363
|
-
|
1364
|
-
// If not already set, we use the first row as a guideline
|
1365
|
-
tableCellWidth = row.cell.length;
|
1366
|
-
}
|
1367
|
-
if ( tableCellWidth !== row.cell.length ) {
|
1368
|
-
row.spannedRow = spannedRow;
|
1369
|
-
$obj.trigger( {
|
1370
|
-
type: warningEvent,
|
1371
|
-
pointer: row.elem,
|
1372
|
-
err: 16
|
1373
|
-
} );
|
1374
|
-
}
|
1375
|
-
|
1376
|
-
// Check if we are into a thead rowgroup, if yes we stop here.
|
1377
|
-
if ( stackRowHeader ) {
|
1378
|
-
theadRowStack.push( row );
|
1379
|
-
return;
|
1380
|
-
}
|
1381
|
-
|
1382
|
-
// Add the last colgroup
|
1383
|
-
row.colgroup.push( colgroup );
|
1384
|
-
|
1385
|
-
//
|
1386
|
-
// Diggest the row
|
1387
|
-
//
|
1388
|
-
if ( lastCellType === "th" ) {
|
1389
|
-
|
1390
|
-
// Digest the row header
|
1391
|
-
row.type = 1;
|
1392
|
-
|
1393
|
-
//
|
1394
|
-
// Check the validity of this header row
|
1395
|
-
//
|
1396
|
-
|
1397
|
-
if ( row.colgroup.length === 2 && currentRowPos === 1 ) {
|
1398
|
-
|
1399
|
-
// Check if the first is a data colgroup with only one cell
|
1400
|
-
if ( row.colgroup[ 0 ].type === 2 && row.colgroup[ 0 ].cell.length === 1 ) {
|
1401
|
-
|
1402
|
-
// Valid row header for the row group header
|
1403
|
-
|
1404
|
-
// REQUIRED: That cell need to be empty
|
1405
|
-
if ( $( row.colgroup[ 0 ].cell [ 0 ].elem ).html().length === 0 ) {
|
1406
|
-
|
1407
|
-
// We stack the row
|
1408
|
-
theadRowStack.push( row );
|
1409
|
-
|
1410
|
-
// We do not go further
|
1411
|
-
return;
|
1412
|
-
}
|
1413
|
-
$obj.trigger( {
|
1414
|
-
type: warningEvent,
|
1415
|
-
pointer: $obj,
|
1416
|
-
err: 17
|
1417
|
-
} );
|
1418
|
-
} else {
|
1419
|
-
|
1420
|
-
// Invalid row header
|
1421
|
-
$obj.trigger( {
|
1422
|
-
type: warningEvent,
|
1423
|
-
pointer: $obj,
|
1424
|
-
err: 18
|
1425
|
-
} );
|
1426
|
-
}
|
1427
|
-
}
|
1428
|
-
|
1429
|
-
if ( row.colgroup.length === 1 ) {
|
1430
|
-
if ( row.colgroup[ 0 ].cell.length > 1 ) {
|
1431
|
-
|
1432
|
-
// this is a row associated to a header row group
|
1433
|
-
if ( !headerRowGroupCompleted ) {
|
1434
|
-
|
1435
|
-
// Good row, stack the row
|
1436
|
-
theadRowStack.push( row );
|
1437
|
-
|
1438
|
-
// We do not go further
|
1439
|
-
return;
|
1440
|
-
}
|
1441
|
-
|
1442
|
-
// Bad row, remove the row or split the table
|
1443
|
-
$obj.trigger( {
|
1444
|
-
type: warningEvent,
|
1445
|
-
pointer: $obj,
|
1446
|
-
err: 18
|
1447
|
-
} );
|
1448
|
-
} else {
|
1449
|
-
if ( currentRowPos !== 1 || row.cell[ 0 ].uid === row.cell[ row.cell.length - 1 ].uid ) {
|
1450
|
-
|
1451
|
-
// Stack the row found for the rowgroup header
|
1452
|
-
rowgroupHeaderRowStack.push( row );
|
1453
|
-
|
1454
|
-
// This will be processed on the first data row
|
1455
|
-
// End of any header row group (thead)
|
1456
|
-
headerRowGroupCompleted = true;
|
1457
|
-
|
1458
|
-
return;
|
1459
|
-
}
|
1460
|
-
$obj.trigger( {
|
1461
|
-
type: warningEvent,
|
1462
|
-
pointer: $obj,
|
1463
|
-
err: 18
|
1464
|
-
} );
|
1465
|
-
}
|
1466
|
-
}
|
1467
|
-
|
1468
|
-
if ( row.colgroup.length > 1 && currentRowPos !== 1 ) {
|
1469
|
-
$obj.trigger( {
|
1470
|
-
type: warningEvent,
|
1471
|
-
pointer: $obj,
|
1472
|
-
err: 21
|
1473
|
-
} );
|
1474
|
-
}
|
1475
|
-
|
1476
|
-
//
|
1477
|
-
// If Valid, process the row
|
1478
|
-
//
|
1479
|
-
} else {
|
1480
|
-
|
1481
|
-
// Digest the data row or summary row
|
1482
|
-
row.type = 2;
|
1483
|
-
|
1484
|
-
// This mark the end of any row group header (thead)
|
1485
|
-
headerRowGroupCompleted = true;
|
1486
|
-
|
1487
|
-
// Check if this row is considerated as a description row for a header
|
1488
|
-
if ( rowgroupHeaderRowStack.length > 0 && row.cell[ 0 ].uid === row.cell[ row.cell.length - 1 ].uid ) {
|
1489
|
-
|
1490
|
-
// Horay this row are a description cell for the preceding heading
|
1491
|
-
|
1492
|
-
row.type = 5;
|
1493
|
-
row.cell[ 0 ].type = 5;
|
1494
|
-
row.cell[ 0 ].row = row;
|
1495
|
-
if ( !row.cell[ 0 ].describe ) {
|
1496
|
-
row.cell[ 0 ].describe = [];
|
1497
|
-
}
|
1498
|
-
rowgroupHeaderRowStack[ rowgroupHeaderRowStack.length - 1 ].cell[ 0 ].descCell = row.cell[ 0 ];
|
1499
|
-
row.cell[ 0 ].describe.push( rowgroupHeaderRowStack[ rowgroupHeaderRowStack.length - 1 ].cell[ 0 ] );
|
1500
|
-
if ( !groupZero.desccell ) {
|
1501
|
-
groupZero.desccell = [];
|
1502
|
-
}
|
1503
|
-
groupZero.desccell.push( row.cell[ 0 ] );
|
1504
|
-
|
1505
|
-
// FYI - We do not push this row in any stack because this row is a description row
|
1506
|
-
|
1507
|
-
// Stop the processing for this row
|
1508
|
-
return;
|
1509
|
-
}
|
1510
|
-
|
1511
|
-
//
|
1512
|
-
// Process any row used to defined the rowgroup label
|
1513
|
-
//
|
1514
|
-
if ( rowgroupHeaderRowStack.length > 0 || !currentRowGroup.type ) {
|
1515
|
-
rowgroupSetup();
|
1516
|
-
}
|
1517
|
-
row.type = currentRowGroup.type;
|
1518
|
-
row.level = currentRowGroup.level;
|
1519
|
-
|
1520
|
-
if ( colgroupFrame[ 0 ] && lastHeadingColPos && colgroupFrame[ 0 ].end !== lastHeadingColPos && colgroupFrame[ 0 ].end === ( lastHeadingColPos + 1 ) ) {
|
1521
|
-
|
1522
|
-
// Adjust if required, the lastHeadingColPos if colgroup are present, that would be the first colgroup
|
1523
|
-
lastHeadingColPos += 1;
|
1524
|
-
}
|
1525
|
-
row.lastHeadingColPos = lastHeadingColPos;
|
1526
|
-
if ( !currentRowGroup.lastHeadingColPos ) {
|
1527
|
-
currentRowGroup.lastHeadingColPos = lastHeadingColPos;
|
1528
|
-
}
|
1529
|
-
if ( !previousDataHeadingColPos ) {
|
1530
|
-
previousDataHeadingColPos = lastHeadingColPos;
|
1531
|
-
}
|
1532
|
-
row.rowgroup = currentRowGroup;
|
1533
|
-
|
1534
|
-
if ( currentRowGroup.lastHeadingColPos !== lastHeadingColPos ) {
|
1535
|
-
if ( ( !lastHeadingSummaryColPos && currentRowGroup.lastHeadingColPos < lastHeadingColPos ) || ( lastHeadingSummaryColPos && lastHeadingSummaryColPos === lastHeadingColPos ) ) {
|
1536
|
-
|
1537
|
-
// This is a virtual summary row group
|
1538
|
-
|
1539
|
-
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
1540
|
-
$.each( spannedRow, function() {
|
1541
|
-
if ( this && this.spanHeight > 0 ) {
|
1542
|
-
|
1543
|
-
// That row are spanned in 2 different row group
|
1544
|
-
$obj.trigger( {
|
1545
|
-
type: warningEvent,
|
1546
|
-
pointer: this,
|
1547
|
-
err: 29
|
1548
|
-
} );
|
1549
|
-
}
|
1550
|
-
} );
|
1551
|
-
|
1552
|
-
// Cleanup of any spanned row
|
1553
|
-
spannedRow = [];
|
1554
|
-
|
1555
|
-
// Remove any rowgroup header found.
|
1556
|
-
rowgroupHeaderRowStack = [];
|
1557
|
-
|
1558
|
-
finalizeRowGroup();
|
1559
|
-
|
1560
|
-
currentRowGroupElement = undefined;
|
1561
|
-
initiateRowGroup();
|
1562
|
-
rowgroupSetup();
|
1563
|
-
|
1564
|
-
// Reset the current row type
|
1565
|
-
row.type = currentRowGroup.type;
|
1566
|
-
|
1567
|
-
} else if ( lastHeadingSummaryColPos && previousDataHeadingColPos === lastHeadingColPos ) {
|
1568
|
-
|
1569
|
-
// This is a virtual data row group
|
1570
|
-
|
1571
|
-
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
1572
|
-
$.each( spannedRow, function() {
|
1573
|
-
if ( this && this.spanHeight > 0 ) {
|
1574
|
-
|
1575
|
-
// That row are spanned in 2 different row group
|
1576
|
-
$obj.trigger( {
|
1577
|
-
type: warningEvent,
|
1578
|
-
pointer: this,
|
1579
|
-
err: 29
|
1580
|
-
} );
|
1581
|
-
}
|
1582
|
-
} );
|
1583
|
-
|
1584
|
-
// Cleanup of any spanned row
|
1585
|
-
spannedRow = [];
|
1586
|
-
|
1587
|
-
// Remove any rowgroup header found.
|
1588
|
-
rowgroupHeaderRowStack = [];
|
1589
|
-
|
1590
|
-
finalizeRowGroup();
|
1591
|
-
|
1592
|
-
currentRowGroupElement = undefined;
|
1593
|
-
initiateRowGroup();
|
1594
|
-
rowgroupSetup( true );
|
1595
|
-
|
1596
|
-
// Reset the current row type
|
1597
|
-
row.type = currentRowGroup.type;
|
1598
|
-
|
1599
|
-
$obj.trigger( {
|
1600
|
-
type: warningEvent,
|
1601
|
-
pointer: row.elem,
|
1602
|
-
err: 34
|
1603
|
-
} );
|
1604
|
-
|
1605
|
-
} else {
|
1606
|
-
$obj.trigger( {
|
1607
|
-
type: warningEvent,
|
1608
|
-
pointer: $obj,
|
1609
|
-
err: 32
|
1610
|
-
} );
|
1611
|
-
}
|
1612
|
-
}
|
1613
|
-
if ( !currentRowGroup.lastHeadingColPos ) {
|
1614
|
-
currentRowGroup.lastHeadingColPos = lastHeadingColPos;
|
1615
|
-
}
|
1616
|
-
|
1617
|
-
if ( currentRowGroup.type === 3 && !lastHeadingSummaryColPos ) {
|
1618
|
-
lastHeadingSummaryColPos = lastHeadingColPos;
|
1619
|
-
}
|
1620
|
-
|
1621
|
-
// Build the initial colgroup structure
|
1622
|
-
// If an cell header exist in that row....
|
1623
|
-
if ( lastHeadingColPos ) {
|
1624
|
-
|
1625
|
-
// Process the heading colgroup associated to this row.
|
1626
|
-
headingRowCell = [];
|
1627
|
-
|
1628
|
-
rowheader = undefined; /* This is the most precise cell header for this row */
|
1629
|
-
colKeyCell = [];
|
1630
|
-
|
1631
|
-
for ( i = 0; i < lastHeadingColPos; i += 1 ) {
|
1632
|
-
|
1633
|
-
// Check for description cell or key cell
|
1634
|
-
if ( row.cell[ i ].elem.nodeName.toLowerCase() === "td" ) {
|
1635
|
-
|
1636
|
-
if ( !row.cell[ i ].type && row.cell[ i - 1 ] && !( row.cell[ i - 1 ].descCell ) && row.cell[ i - 1 ].type === 1 && row.cell[ i - 1 ].height === row.cell[ i ].height ) {
|
1637
|
-
row.cell[ i ].type = 5;
|
1638
|
-
row.cell[ i - 1 ].descCell = row.cell[ i ];
|
1639
|
-
|
1640
|
-
if ( !row.cell[ i ].describe ) {
|
1641
|
-
row.cell[ i ].describe = [];
|
1642
|
-
}
|
1643
|
-
row.cell[ i ].describe.push( row.cell[ i - 1 ] );
|
1644
|
-
|
1645
|
-
if ( !row.desccell ) {
|
1646
|
-
row.desccell = [];
|
1647
|
-
}
|
1648
|
-
row.desccell.push( row.cell[ i ] );
|
1649
|
-
|
1650
|
-
if ( !groupZero.desccell ) {
|
1651
|
-
groupZero.desccell = [];
|
1652
|
-
}
|
1653
|
-
groupZero.desccell.push( row.cell[ i ] );
|
1654
|
-
|
1655
|
-
// Specify the scope of this description cell
|
1656
|
-
row.cell[ i ].scope = "row";
|
1657
|
-
}
|
1658
|
-
|
1659
|
-
// Check if this cell can be an key cell associated to an cell heading
|
1660
|
-
if ( !row.cell[ i ].type ) {
|
1661
|
-
colKeyCell.push( row.cell[ i ] );
|
1662
|
-
}
|
1663
|
-
}
|
1664
|
-
|
1665
|
-
// Set for the most appropriate header that can represent this row
|
1666
|
-
if ( row.cell[ i ].elem.nodeName.toLowerCase() === "th" ) {
|
1667
|
-
|
1668
|
-
// Mark the cell to be an header cell
|
1669
|
-
row.cell[ i ].type = 1;
|
1670
|
-
row.cell[ i ].scope = "row";
|
1671
|
-
if ( rowheader && rowheader.uid !== row.cell[ i ].uid ) {
|
1672
|
-
if ( rowheader.height >= row.cell[ i ].height ) {
|
1673
|
-
if ( rowheader.height === row.cell[ i ].height ) {
|
1674
|
-
$obj.trigger( {
|
1675
|
-
type: warningEvent,
|
1676
|
-
pointer: $obj,
|
1677
|
-
err: 23
|
1678
|
-
} );
|
1679
|
-
}
|
1680
|
-
|
1681
|
-
// The current cell are a child of the previous rowheader
|
1682
|
-
if ( !rowheader.subheader ) {
|
1683
|
-
rowheader.subheader = [];
|
1684
|
-
rowheader.isgroup = true;
|
1685
|
-
}
|
1686
|
-
rowheader.subheader.push( row.cell[ i ] );
|
1687
|
-
|
1688
|
-
// Change the current row header
|
1689
|
-
rowheader = row.cell[ i ];
|
1690
|
-
headingRowCell.push( row.cell[ i ] );
|
1691
|
-
} else {
|
1692
|
-
|
1693
|
-
// This case are either paralel heading of growing header, this are an error.
|
1694
|
-
$obj.trigger( {
|
1695
|
-
type: warningEvent,
|
1696
|
-
pointer: $obj,
|
1697
|
-
err: 24
|
1698
|
-
} );
|
1699
|
-
}
|
1700
|
-
}
|
1701
|
-
if ( !rowheader ) {
|
1702
|
-
rowheader = row.cell[ i ];
|
1703
|
-
headingRowCell.push( row.cell[ i ] );
|
1704
|
-
}
|
1705
|
-
for ( j = 0; j < colKeyCell.length; j += 1 ) {
|
1706
|
-
if ( !( colKeyCell[ j ].type ) && !( row.cell[ i ].keycell ) && colKeyCell[ j ].height === row.cell[ i ].height ) {
|
1707
|
-
colKeyCell[ j ].type = 4;
|
1708
|
-
row.cell[ i ].keycell = colKeyCell[ j ];
|
1709
|
-
|
1710
|
-
if ( !row.keycell ) {
|
1711
|
-
row.keycell = [];
|
1712
|
-
}
|
1713
|
-
row.keycell.push( colKeyCell[ j ] );
|
1714
|
-
|
1715
|
-
if ( !groupZero.keycell ) {
|
1716
|
-
groupZero.keycell = [];
|
1717
|
-
}
|
1718
|
-
groupZero.keycell.push( colKeyCell[ j ] );
|
1719
|
-
|
1720
|
-
if ( !colKeyCell[ j ].describe ) {
|
1721
|
-
colKeyCell[ j ].describe = [];
|
1722
|
-
}
|
1723
|
-
colKeyCell[ j ].describe.push( row.cell[ i ] );
|
1724
|
-
}
|
1725
|
-
}
|
1726
|
-
}
|
1727
|
-
}
|
1728
|
-
|
1729
|
-
// All the cell that have no "type" in the colKeyCell collection are problematic cells
|
1730
|
-
$.each( colKeyCell, function() {
|
1731
|
-
if ( !( this.type ) ) {
|
1732
|
-
$obj.trigger( {
|
1733
|
-
type: warningEvent,
|
1734
|
-
pointer: $obj,
|
1735
|
-
err: 25
|
1736
|
-
} );
|
1737
|
-
if ( !row.errorcell ) {
|
1738
|
-
row.errorcell = [];
|
1739
|
-
}
|
1740
|
-
row.errorcell.push( this );
|
1741
|
-
}
|
1742
|
-
} );
|
1743
|
-
row.header = headingRowCell;
|
1744
|
-
} else {
|
1745
|
-
|
1746
|
-
// There are only at least one colgroup,
|
1747
|
-
// Any colgroup tag defined but be equal or greater than 0.
|
1748
|
-
// if colgroup tag defined, they are all data colgroup.
|
1749
|
-
lastHeadingColPos = 0;
|
1750
|
-
|
1751
|
-
if ( colgroupFrame.length === 0 ) {
|
1752
|
-
processColgroup( undefined, tableCellWidth );
|
1753
|
-
}
|
1754
|
-
}
|
1755
|
-
|
1756
|
-
//
|
1757
|
-
// Process the table row heading and colgroup if required
|
1758
|
-
//
|
1759
|
-
processRowgroupHeader( lastHeadingColPos );
|
1760
|
-
|
1761
|
-
row.headerset = ( currentRowGroup.headerlevel || [] );
|
1762
|
-
|
1763
|
-
if ( lastHeadingColPos !== 0 ) {
|
1764
|
-
lastHeadingColPos = colgroupFrame[ 0 ].end; /* colgroupFrame must be defined here */
|
1765
|
-
}
|
1766
|
-
|
1767
|
-
//
|
1768
|
-
// Associate the data cell type with the colgroup if any,
|
1769
|
-
// Process the data cell. There are a need to have at least one data cell per data row.
|
1770
|
-
if ( !row.datacell ) {
|
1771
|
-
row.datacell = [];
|
1772
|
-
}
|
1773
|
-
for ( i = lastHeadingColPos; i < row.cell.length; i += 1 ) {
|
1774
|
-
isDataColgroupType = true;
|
1775
|
-
|
1776
|
-
for ( j = ( lastHeadingColPos === 0 ? 0 : 1 ); j < colgroupFrame.length; j += 1 ) {
|
1777
|
-
|
1778
|
-
// If colgroup, the first are always header colgroup
|
1779
|
-
if ( colgroupFrame[ j ].start <= row.cell[ i ].colpos && row.cell[ i ].colpos <= colgroupFrame[ j ].end ) {
|
1780
|
-
if ( row.type === 3 || colgroupFrame[ j ].type === 3 ) {
|
1781
|
-
row.cell[ i ].type = 3; /* Summary Cell */
|
1782
|
-
} else {
|
1783
|
-
row.cell[ i ].type = 2;
|
1784
|
-
}
|
1785
|
-
|
1786
|
-
// Test if this cell is a layout cell
|
1787
|
-
if ( row.type === 3 && colgroupFrame[ j ].type === 3 && ( $( row.cell[ i ].elem ).text().length === 0 ) ) {
|
1788
|
-
row.cell[ i ].type = 6;
|
1789
|
-
if ( !groupZero.layoutCell ) {
|
1790
|
-
groupZero.layoutCell = [];
|
1791
|
-
}
|
1792
|
-
groupZero.layoutCell.push( row.cell[ i ] );
|
1793
|
-
}
|
1794
|
-
|
1795
|
-
row.cell[ i ].collevel = colgroupFrame[ j ].level;
|
1796
|
-
row.datacell.push( row.cell[ i ] );
|
1797
|
-
}
|
1798
|
-
isDataColgroupType = !isDataColgroupType;
|
1799
|
-
}
|
1800
|
-
|
1801
|
-
if ( colgroupFrame.length === 0 ) {
|
1802
|
-
|
1803
|
-
// There are no colgroup definition, this cell are set to be a datacell
|
1804
|
-
row.cell[ i ].type = 2;
|
1805
|
-
row.datacell.push( row.cell[ i ] );
|
1806
|
-
}
|
1807
|
-
|
1808
|
-
// Add row header when the cell is span into more than one row
|
1809
|
-
if ( row.cell[ i ].rowpos < currentRowPos ) {
|
1810
|
-
if ( !row.cell[ i ].addrowheaders ) {
|
1811
|
-
|
1812
|
-
// addrowheaders for additional row headers
|
1813
|
-
row.cell[ i ].addrowheaders = [];
|
1814
|
-
}
|
1815
|
-
if ( row.header ) {
|
1816
|
-
for ( j = 0; j < row.header.length; j += 1 ) {
|
1817
|
-
if ( ( row.header[ j ].rowpos === currentRowPos && row.cell[ i ].addrowheaders.length === 0 ) || ( row.header[ j ].rowpos === currentRowPos && row.cell[ i ].addrowheaders[ row.cell[ i ].addrowheaders.length - 1 ].uid !== row.header[ j ].uid ) ) {
|
1818
|
-
|
1819
|
-
// Add the current header
|
1820
|
-
row.cell[ i ].addrowheaders.push( row.header[ j ] );
|
1821
|
-
}
|
1822
|
-
}
|
1823
|
-
}
|
1824
|
-
}
|
1825
|
-
}
|
1826
|
-
|
1827
|
-
// Add the cell in his appropriate column
|
1828
|
-
if ( !groupZero.col ) {
|
1829
|
-
groupZero.col = [];
|
1830
|
-
}
|
1831
|
-
|
1832
|
-
for ( i = 0; i < groupZero.col.length; i += 1 ) {
|
1833
|
-
for ( j = ( groupZero.col[ i ].start - 1 ); j < groupZero.col[ i ].end; j += 1 ) {
|
1834
|
-
if ( !groupZero.col[ i ].cell ) {
|
1835
|
-
groupZero.col[ i ].cell = [];
|
1836
|
-
}
|
1837
|
-
|
1838
|
-
// Be sure to do not include twice the same cell for a column spanned in 2 or more column
|
1839
|
-
if ( !( j > ( groupZero.col[ i ].start - 1 ) && groupZero.col[ i ].cell[ groupZero.col[ i ].cell.length - 1 ].uid === row.cell[ j ].uid ) ) {
|
1840
|
-
if ( row.cell[ j ] ) {
|
1841
|
-
groupZero.col[ i ].cell.push( row.cell[ j ] );
|
1842
|
-
if ( !row.cell[ j ].col ) {
|
1843
|
-
row.cell[ j ].col = groupZero.col[ i ];
|
1844
|
-
}
|
1845
|
-
} else {
|
1846
|
-
$obj.trigger( {
|
1847
|
-
type: warningEvent,
|
1848
|
-
pointer: $obj,
|
1849
|
-
err: 35
|
1850
|
-
} );
|
1851
|
-
}
|
1852
|
-
}
|
1853
|
-
}
|
1854
|
-
}
|
1855
|
-
|
1856
|
-
// Associate the row with the cell and Colgroup/Col association
|
1857
|
-
for ( i = 0; i < row.cell.length; i += 1 ) {
|
1858
|
-
if ( !row.cell[ i ].row ) {
|
1859
|
-
row.cell[ i ].row = row;
|
1860
|
-
}
|
1861
|
-
row.cell[ i ].rowlevel = currentRowGroup.level;
|
1862
|
-
row.cell[ i ].rowlevelheader = currentRowGroup.headerlevel;
|
1863
|
-
row.cell[ i ].rowgroup = currentRowGroup;
|
1864
|
-
|
1865
|
-
if ( i > 0 && row.cell[ i - 1 ].uid === row.cell[ i ].uid && row.cell[ i ].type !== 1 && row.cell[ i ].type !== 5 && row.cell[ i ].rowpos === currentRowPos && row.cell[ i ].colpos <= i ) {
|
1866
|
-
if ( !row.cell[ i ].addcolheaders ) {
|
1867
|
-
|
1868
|
-
// addcolheaders for additional col headers
|
1869
|
-
row.cell[ i ].addcolheaders = [];
|
1870
|
-
}
|
1871
|
-
|
1872
|
-
// Add the column header if required
|
1873
|
-
if ( groupZero.col[ i ] && groupZero.col[ i ].header ) {
|
1874
|
-
for ( j = 0; j < groupZero.col[ i ].header.length; j += 1 ) {
|
1875
|
-
if ( groupZero.col[ i ].header[ j ].colpos === ( i + 1 ) ) {
|
1876
|
-
|
1877
|
-
// Add the current header
|
1878
|
-
row.cell[ i ].addcolheaders.push( groupZero.col[ i ] .header[ j ] );
|
1879
|
-
}
|
1880
|
-
}
|
1881
|
-
}
|
1882
|
-
}
|
1883
|
-
}
|
1884
|
-
}
|
1885
|
-
|
1886
|
-
// Add the row to the groupZero
|
1887
|
-
if ( !groupZero.row ) {
|
1888
|
-
groupZero.row = [];
|
1889
|
-
}
|
1890
|
-
groupZero.row.push( row );
|
1891
|
-
currentRowGroup.row.push( row );
|
1892
|
-
|
1893
|
-
delete row.colgroup;
|
1894
|
-
} /* End processRow function */
|
1895
|
-
|
1896
|
-
// Add headers information to the table parsed data structure
|
1897
|
-
// Similar sample of code as the HTML Table validator
|
1898
|
-
function addHeaders( tblparser ) {
|
1899
|
-
var headStackLength = tblparser.theadRowStack.length,
|
1900
|
-
addColHeadersLength, addRowHeadersLength,
|
1901
|
-
cellHeaderLength, cellLength, childLength, coldataheader,
|
1902
|
-
colheaders, colheadersgroup, currCell, currCol, currRow,
|
1903
|
-
currrowheader, headerLength, headerLevelLength, i, j, k, m, ongoingRowHeader, ongoingRowHeaderLength,
|
1904
|
-
rowheaders,
|
1905
|
-
rowheadersgroup, rowLength;
|
1906
|
-
|
1907
|
-
// Set ID and Header for the table head
|
1908
|
-
for ( i = 0; i < headStackLength; i += 1 ) {
|
1909
|
-
currRow = tblparser.theadRowStack[ i ];
|
1910
|
-
|
1911
|
-
for ( j = 0, cellLength = currRow.cell.length; j < cellLength; j += 1 ) {
|
1912
|
-
currCell = currRow.cell[ j ];
|
1913
|
-
|
1914
|
-
if ( ( currCell.type === 1 || currCell.type === 7 ) && (
|
1915
|
-
!( j > 0 && currCell.uid === currRow.cell[ j - 1 ].uid ) &&
|
1916
|
-
!( i > 0 && currCell.uid === tblparser.theadRowStack[ i - 1 ].cell[ j ].uid )
|
1917
|
-
) ) {
|
1918
|
-
|
1919
|
-
// Imediate header
|
1920
|
-
currCell.header = currCell.header || [];
|
1921
|
-
|
1922
|
-
// all the headers
|
1923
|
-
currCell.headers = currCell.headers || [];
|
1924
|
-
|
1925
|
-
// Imediate sub cell
|
1926
|
-
currCell.child = currCell.child || [];
|
1927
|
-
|
1928
|
-
// All the sub cell
|
1929
|
-
currCell.childs = currCell.childs || [];
|
1930
|
-
|
1931
|
-
// Set the header of the current cell if required
|
1932
|
-
if ( i > 0 ) {
|
1933
|
-
|
1934
|
-
// All the header cells
|
1935
|
-
for ( k = 0, cellHeaderLength = tblparser.theadRowStack[ i - 1 ].cell[ j ].header.length; k < cellHeaderLength; k += 1 ) {
|
1936
|
-
currCell.headers.push( tblparser.theadRowStack[ i - 1 ].cell[ j ].header[ k ] );
|
1937
|
-
tblparser.theadRowStack[ i - 1 ].cell[ j ].header[ k ].childs.push( currCell );
|
1938
|
-
}
|
1939
|
-
|
1940
|
-
// Imediate header cell
|
1941
|
-
currCell.headers.push( tblparser.theadRowStack[ i - 1 ].cell[ j ] );
|
1942
|
-
currCell.header.push( tblparser.theadRowStack[ i - 1 ].cell[ j ] );
|
1943
|
-
tblparser.theadRowStack[ i - 1 ].cell[ j ].child.push( currCell );
|
1944
|
-
}
|
1945
|
-
|
1946
|
-
// Set the header on his descriptive cell if any
|
1947
|
-
if ( currCell.descCell ) {
|
1948
|
-
currCell.descCell.header = currCell;
|
1949
|
-
currCell.descCell.headers = currCell;
|
1950
|
-
}
|
1951
|
-
}
|
1952
|
-
|
1953
|
-
}
|
1954
|
-
|
1955
|
-
}
|
1956
|
-
|
1957
|
-
// Set Id/headers for header cell and data cell in the table.
|
1958
|
-
for ( i = 0, rowLength = tblparser.row.length; i < rowLength; i += 1 ) {
|
1959
|
-
currRow = tblparser.row[ i ];
|
1960
|
-
rowheadersgroup = [];
|
1961
|
-
rowheaders = [];
|
1962
|
-
currrowheader = [];
|
1963
|
-
ongoingRowHeader = [];
|
1964
|
-
coldataheader = [];
|
1965
|
-
|
1966
|
-
// Get or Generate a unique ID for each header in this row
|
1967
|
-
if ( currRow.headerset && !currRow.idsheaderset ) {
|
1968
|
-
for ( j = 0; j < currRow.headerset.length; j += 1 ) {
|
1969
|
-
rowheadersgroup = rowheadersgroup.concat( currRow.headerset[ j ] );
|
1970
|
-
}
|
1971
|
-
currRow.idsheaderset = rowheadersgroup;
|
1972
|
-
}
|
1973
|
-
|
1974
|
-
if ( currRow.header ) {
|
1975
|
-
for ( j = 0; j < currRow.header.length; j += 1 ) {
|
1976
|
-
rowheaders = rowheaders.concat( currRow.header[ j ] );
|
1977
|
-
}
|
1978
|
-
}
|
1979
|
-
rowheaders = currRow.idsheaderset.concat( rowheaders );
|
1980
|
-
for ( j = 0; j < currRow.cell.length; j += 1 ) {
|
1981
|
-
|
1982
|
-
if ( j === 0 || ( j > 0 && currRow.cell[ j ].uid !== currRow.cell[ ( j - 1 ) ].uid ) ) {
|
1983
|
-
currCell = currRow.cell[ j ];
|
1984
|
-
coldataheader = [];
|
1985
|
-
|
1986
|
-
// Imediate header
|
1987
|
-
currCell.header = currCell.header || [];
|
1988
|
-
|
1989
|
-
// all the headers
|
1990
|
-
currCell.headers = currCell.headers || [];
|
1991
|
-
|
1992
|
-
if ( currCell.col && !currCell.col.dataheader ) {
|
1993
|
-
currCol = currCell.col;
|
1994
|
-
colheaders = [];
|
1995
|
-
colheadersgroup = [];
|
1996
|
-
if ( currCol.headerLevel ) {
|
1997
|
-
for ( m = 0, headerLevelLength = currCol.headerLevel.length; m < headerLevelLength; m += 1 ) {
|
1998
|
-
colheadersgroup = colheadersgroup.concat( currCol.headerLevel[ m ] );
|
1999
|
-
}
|
2000
|
-
}
|
2001
|
-
if ( currCol.header ) {
|
2002
|
-
for ( m = 0, headerLength = currCol.header.length; m < headerLength; m += 1 ) {
|
2003
|
-
colheaders = colheaders.concat( currCol.header[ m ] );
|
2004
|
-
}
|
2005
|
-
}
|
2006
|
-
|
2007
|
-
if ( !currCol.dataheader ) {
|
2008
|
-
currCol.dataheader = [];
|
2009
|
-
}
|
2010
|
-
|
2011
|
-
currCol.dataheader = currCol.dataheader.concat( colheadersgroup );
|
2012
|
-
currCol.dataheader = currCol.dataheader.concat( colheaders );
|
2013
|
-
}
|
2014
|
-
|
2015
|
-
if ( currCell.col && currCell.col.dataheader ) {
|
2016
|
-
coldataheader = currCell.col.dataheader;
|
2017
|
-
}
|
2018
|
-
|
2019
|
-
if ( currCell.type === 1 ) {
|
2020
|
-
|
2021
|
-
// Imediate sub cell
|
2022
|
-
currCell.child = currCell.child || [];
|
2023
|
-
|
2024
|
-
// All the sub cell
|
2025
|
-
currCell.childs = currCell.childs || [];
|
2026
|
-
|
2027
|
-
for ( m = 0, ongoingRowHeaderLength = ongoingRowHeader.length; m < ongoingRowHeaderLength; m += 1 ) {
|
2028
|
-
|
2029
|
-
if ( currCell.colpos === ( ongoingRowHeader[ m ].colpos + ongoingRowHeader[ m ].width ) ) {
|
2030
|
-
childLength = ongoingRowHeader[ m ].child.length;
|
2031
|
-
if ( childLength === 0 || ( childLength > 0 && ongoingRowHeader[ m ].child[ childLength - 1 ].uid !== currCell.uid ) ) {
|
2032
|
-
ongoingRowHeader[ m ].child.push( currCell );
|
2033
|
-
}
|
2034
|
-
}
|
2035
|
-
ongoingRowHeader[ m ].childs.push( currCell );
|
2036
|
-
}
|
2037
|
-
|
2038
|
-
for ( m = 0; m < currRow.idsheaderset.length; m += 1 ) {
|
2039
|
-
|
2040
|
-
// All the sub cell
|
2041
|
-
if ( !currRow.idsheaderset[ m ].childs ) {
|
2042
|
-
currRow.idsheaderset[ m ].childs = [];
|
2043
|
-
}
|
2044
|
-
currRow.idsheaderset[ m ].childs.push( currCell );
|
2045
|
-
}
|
2046
|
-
|
2047
|
-
currCell.header = currCell.header.concat( ongoingRowHeader );
|
2048
|
-
|
2049
|
-
currCell.headers = currCell.headers.concat( coldataheader )
|
2050
|
-
.concat( currRow.idsheaderset )
|
2051
|
-
.concat( ongoingRowHeader );
|
2052
|
-
|
2053
|
-
ongoingRowHeader = ongoingRowHeader.concat( currCell );
|
2054
|
-
}
|
2055
|
-
|
2056
|
-
if ( currCell.type === 2 || currCell.type === 3 ) {
|
2057
|
-
|
2058
|
-
// Get Current Column Headers
|
2059
|
-
currrowheader = rowheaders;
|
2060
|
-
|
2061
|
-
if ( currCell.addcolheaders ) {
|
2062
|
-
for ( m = 0, addColHeadersLength = currCell.addcolheaders.length; m < addColHeadersLength; m += 1 ) {
|
2063
|
-
coldataheader = coldataheader.concat( currCell.addcolheaders[ m ] );
|
2064
|
-
}
|
2065
|
-
}
|
2066
|
-
|
2067
|
-
if ( currCell.addrowheaders ) {
|
2068
|
-
for ( m = 0, addRowHeadersLength = currCell.addrowheaders.length; m < addRowHeadersLength; m += 1 ) {
|
2069
|
-
currrowheader = currrowheader.concat( currCell.addrowheaders[ m ] );
|
2070
|
-
}
|
2071
|
-
}
|
2072
|
-
|
2073
|
-
currCell.headers = currCell.headers.concat( coldataheader )
|
2074
|
-
.concat( currrowheader );
|
2075
|
-
|
2076
|
-
currCell.header = currCell.headers;
|
2077
|
-
}
|
2078
|
-
}
|
2079
|
-
}
|
2080
|
-
}
|
2081
|
-
} /* END addHeaders function*/
|
2082
|
-
|
2083
|
-
//
|
2084
|
-
// Main Entry For The Table Parsing
|
2085
|
-
//
|
2086
|
-
if ( hasTfoot ) {
|
2087
|
-
|
2088
|
-
// If there is a tfoot element, be sure to add it at the end of all the tbody. FYI - HTML 5 spec allow now tfoot to be at the end
|
2089
|
-
$( "tfoot", $obj ).appendTo( $( "tbody:last", $obj ).parent() );
|
2090
|
-
}
|
2091
|
-
$obj.children().each( function() {
|
2092
|
-
var $this = $( this ),
|
2093
|
-
nodeName = this.nodeName.toLowerCase();
|
2094
|
-
|
2095
|
-
if ( nodeName === "caption" ) {
|
2096
|
-
processCaption( this );
|
2097
|
-
} else if ( nodeName === "colgroup" ) {
|
2098
|
-
processColgroup( this );
|
2099
|
-
} else if ( nodeName === "thead" ) {
|
2100
|
-
currentRowGroupElement = this;
|
2101
|
-
|
2102
|
-
// The table should not have any row at this point
|
2103
|
-
if ( theadRowStack.length !== 0 || ( groupZero.row && groupZero.row.length > 0 ) ) {
|
2104
|
-
$obj.trigger( {
|
2105
|
-
type: warningEvent,
|
2106
|
-
pointer: this,
|
2107
|
-
err: 26
|
2108
|
-
} );
|
2109
|
-
}
|
2110
|
-
|
2111
|
-
$( this ).data( "tblparser", groupZero );
|
2112
|
-
stackRowHeader = true;
|
2113
|
-
|
2114
|
-
// This is the rowgroup header, Colgroup type can not be defined here
|
2115
|
-
$( this ).children().each( function() {
|
2116
|
-
if ( this.nodeName.toLowerCase() !== "tr" ) {
|
2117
|
-
|
2118
|
-
// ERROR
|
2119
|
-
$obj.trigger( {
|
2120
|
-
type: warningEvent,
|
2121
|
-
pointer: this,
|
2122
|
-
err: 27
|
2123
|
-
} );
|
2124
|
-
}
|
2125
|
-
processRow( this );
|
2126
|
-
} );
|
2127
|
-
|
2128
|
-
stackRowHeader = false;
|
2129
|
-
|
2130
|
-
// Here it"s not possible to Diggest the thead and the colgroup because we need the first data row to be half processed before
|
2131
|
-
} else if ( nodeName === "tbody" || nodeName === "tfoot" ) {
|
2132
|
-
|
2133
|
-
if ( nodeName === "tfoot" ) {
|
2134
|
-
tfootOnProcess = true;
|
2135
|
-
}
|
2136
|
-
|
2137
|
-
// Currently there are no specific support for tfoot element, the tfoot is understood as a normal tbody
|
2138
|
-
|
2139
|
-
currentRowGroupElement = this;
|
2140
|
-
initiateRowGroup();
|
2141
|
-
|
2142
|
-
$this.data().tblparser = currentRowGroup;
|
2143
|
-
|
2144
|
-
/*
|
2145
|
-
*
|
2146
|
-
*
|
2147
|
-
*
|
2148
|
-
* First tbody = data
|
2149
|
-
* All tbody with header === data
|
2150
|
-
* Subsequent tbody without header === summary
|
2151
|
-
*
|
2152
|
-
*/
|
2153
|
-
|
2154
|
-
// New row group
|
2155
|
-
$this.children().each( function() {
|
2156
|
-
if ( this.nodeName.toLowerCase() !== "tr" ) {
|
2157
|
-
|
2158
|
-
// ERROR
|
2159
|
-
$obj.trigger( {
|
2160
|
-
type: warningEvent,
|
2161
|
-
pointer: this,
|
2162
|
-
err: 27
|
2163
|
-
} );
|
2164
|
-
return;
|
2165
|
-
}
|
2166
|
-
processRow( this );
|
2167
|
-
} );
|
2168
|
-
|
2169
|
-
finalizeRowGroup();
|
2170
|
-
|
2171
|
-
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
2172
|
-
$.each( spannedRow, function() {
|
2173
|
-
if ( this && this.spanHeigh && this.spanHeight > 0 ) {
|
2174
|
-
|
2175
|
-
// That row are spanned in 2 different row group
|
2176
|
-
$obj.trigger( {
|
2177
|
-
type: warningEvent,
|
2178
|
-
pointer: this,
|
2179
|
-
err: 29
|
2180
|
-
} );
|
2181
|
-
}
|
2182
|
-
} );
|
2183
|
-
|
2184
|
-
spannedRow = []; /* Cleanup of any spanned row */
|
2185
|
-
rowgroupHeaderRowStack = []; /* Remove any rowgroup header found. */
|
2186
|
-
|
2187
|
-
} else if ( nodeName === "tr" ) {
|
2188
|
-
|
2189
|
-
// This are suppose to be a simple table
|
2190
|
-
processRow( this );
|
2191
|
-
} else {
|
2192
|
-
|
2193
|
-
// There is a DOM Structure error
|
2194
|
-
$obj.trigger( {
|
2195
|
-
type: errorEvent,
|
2196
|
-
pointer: this,
|
2197
|
-
err: 30
|
2198
|
-
} );
|
2199
|
-
}
|
2200
|
-
} );
|
2201
|
-
|
2202
|
-
groupZero.theadRowStack = theadRowStack;
|
2203
|
-
|
2204
|
-
delete groupZero.colgroupFrame;
|
2205
|
-
groupZero.colgrouplevel = groupZero.colgrp;
|
2206
|
-
delete groupZero.colgrp;
|
2207
|
-
|
2208
|
-
addHeaders( groupZero );
|
2209
|
-
|
2210
|
-
$obj.trigger( "parsecomplete" + selector );
|
2211
|
-
};
|
2212
|
-
|
2213
|
-
// Bind the init event of the plugin on passive table parsing request
|
2214
|
-
$document.on( "passiveparse" + selector, init );
|
2215
|
-
|
2216
|
-
} )( jQuery, window, document, wb );
|
1
|
+
/**
|
2
|
+
* Web Experience Toolkit (WET) / Boîte à outils de l'expérience Web (BOEW)
|
3
|
+
* @title Table Parser Plugin
|
4
|
+
* @overview Digest complex tabular data and validate complex table
|
5
|
+
* @license wet-boew.github.io/wet-boew/License-en.html / wet-boew.github.io/wet-boew/Licence-fr.html
|
6
|
+
* @author @duboisp
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
( function( $, window, document, wb ) {
|
10
|
+
"use strict";
|
11
|
+
|
12
|
+
/*
|
13
|
+
* Variable and function definitions.
|
14
|
+
* These are global to the plugin - meaning that they will be initialized once per page,
|
15
|
+
* not once per instance of plugin on the page. So, this is a good place to define
|
16
|
+
* variables that are common to all instances of the plugin on a page.
|
17
|
+
*/
|
18
|
+
var componentName = "wb-tableparser",
|
19
|
+
selector = "." + componentName,
|
20
|
+
errorEvent = "error" + selector,
|
21
|
+
warningEvent = "warning" + selector,
|
22
|
+
$document = wb.doc,
|
23
|
+
|
24
|
+
/**
|
25
|
+
* @method init
|
26
|
+
* @param {jQuery Event} event Event that triggered this handler
|
27
|
+
*/
|
28
|
+
init = function( event ) {
|
29
|
+
if ( event.namespace !== componentName ) {
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
|
33
|
+
var $obj = $( event.target ),
|
34
|
+
groupZero = {
|
35
|
+
allParserObj: [],
|
36
|
+
nbDescriptionRow: 0 /* To remove ?? */
|
37
|
+
},
|
38
|
+
colgroupFrame = [],
|
39
|
+
columnFrame = [],
|
40
|
+
uidElem = 0,
|
41
|
+
currentRowPos = 0,
|
42
|
+
spannedRow = [],
|
43
|
+
tableCellWidth = 0,
|
44
|
+
headerRowGroupCompleted = false,
|
45
|
+
theadRowStack = [],
|
46
|
+
stackRowHeader = false,
|
47
|
+
|
48
|
+
// Row Group Variable
|
49
|
+
rowgroupHeaderRowStack = [],
|
50
|
+
currentRowGroup,
|
51
|
+
currentRowGroupElement,
|
52
|
+
lstRowGroup = [],
|
53
|
+
rowgroupheadercalled = false,
|
54
|
+
hasTfoot = $obj.has( "tfoot" ),
|
55
|
+
lastHeadingSummaryColPos,
|
56
|
+
previousDataHeadingColPos,
|
57
|
+
tfootOnProcess = false,
|
58
|
+
hassumMode = false;
|
59
|
+
|
60
|
+
// obj need to be a table
|
61
|
+
if ( $obj.get( 0 ).nodeName.toLowerCase() !== "table" ) {
|
62
|
+
$obj.trigger( {
|
63
|
+
type: errorEvent,
|
64
|
+
pointer: $obj,
|
65
|
+
err: 1
|
66
|
+
} );
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
|
70
|
+
// Check if this table was already parsed, if yes we exit by throwing an error
|
71
|
+
if ( $obj.tblparser ) {
|
72
|
+
$obj.trigger( {
|
73
|
+
type: errorEvent,
|
74
|
+
pointer: $obj,
|
75
|
+
err: 2
|
76
|
+
} );
|
77
|
+
return;
|
78
|
+
}
|
79
|
+
|
80
|
+
// Check for hassum mode
|
81
|
+
hassumMode = $obj.hasClass( "hassum" );
|
82
|
+
|
83
|
+
/*
|
84
|
+
+-----------------------------------------------------+
|
85
|
+
| FYI - Here the value and signification of each type |
|
86
|
+
+-------+---------------+-----------------------------+
|
87
|
+
| Type | Signification | Technicality
|
88
|
+
+-------+---------------+------------------------------
|
89
|
+
| 1 | Header | TH element only
|
90
|
+
+-------+---------------+------------------------------
|
91
|
+
| 2 | Data | TD element only
|
92
|
+
+-------+---------------+------------------------------
|
93
|
+
| 3 | Summary | TD element and TD of type 2 exist
|
94
|
+
+-------+---------------+------------------------------
|
95
|
+
| 4 | Key | TD element applicable to right TH, Only available on row
|
96
|
+
+-------+---------------+------------------------------
|
97
|
+
| 5 | Description | TD element applicable to left or top TH
|
98
|
+
+-------+---------------+------------------------------
|
99
|
+
| 6 | Layout | Can be only: Top Left cell or/and Summmary group intersection
|
100
|
+
+-------+---------------+------------------------------
|
101
|
+
| 7 | Header Group | TH element only, visual heading grouping, this type are an extension of the type 1
|
102
|
+
+-------+---------------+------------------------------
|
103
|
+
*/
|
104
|
+
$obj.data().tblparser = groupZero;
|
105
|
+
groupZero.colgroup = colgroupFrame;
|
106
|
+
if ( !groupZero.rowgroup ) {
|
107
|
+
groupZero.rowgroup = [];
|
108
|
+
}
|
109
|
+
if ( !groupZero.lstrowgroup ) {
|
110
|
+
groupZero.lstrowgroup = lstRowGroup;
|
111
|
+
}
|
112
|
+
groupZero.elem = $obj;
|
113
|
+
groupZero.uid = uidElem;
|
114
|
+
|
115
|
+
// Set the uid for the groupZero
|
116
|
+
uidElem += 1;
|
117
|
+
|
118
|
+
// Group Cell Header at level 0, scope=col
|
119
|
+
groupZero.colcaption = {};
|
120
|
+
groupZero.colcaption.uid = uidElem;
|
121
|
+
uidElem += 1;
|
122
|
+
groupZero.colcaption.elem = undefined;
|
123
|
+
groupZero.colcaption.type = 7;
|
124
|
+
groupZero.colcaption.dataset = [];
|
125
|
+
groupZero.colcaption.summaryset = [];
|
126
|
+
|
127
|
+
// Group Cell Header at level 0, scope=row
|
128
|
+
groupZero.rowcaption = {};
|
129
|
+
groupZero.rowcaption.uid = uidElem;
|
130
|
+
uidElem += 1;
|
131
|
+
groupZero.rowcaption.elem = undefined;
|
132
|
+
groupZero.rowcaption.type = 7;
|
133
|
+
groupZero.rowcaption.dataset = [];
|
134
|
+
groupZero.rowcaption.summaryset = [];
|
135
|
+
groupZero.col = [];
|
136
|
+
|
137
|
+
function processCaption( elem ) {
|
138
|
+
groupZero.colcaption.elem = elem;
|
139
|
+
groupZero.rowcaption.elem = elem;
|
140
|
+
var groupheadercell = {
|
141
|
+
colcaption: groupZero.colcaption,
|
142
|
+
rowcaption: groupZero.rowcaption,
|
143
|
+
elem: elem
|
144
|
+
},
|
145
|
+
caption,
|
146
|
+
captionFound,
|
147
|
+
description = [];
|
148
|
+
|
149
|
+
// Extract the caption vs the description
|
150
|
+
// There are 2 techniques,
|
151
|
+
// Recommanded is encapsulate the caption with "strong"
|
152
|
+
// Use Details/Summary element
|
153
|
+
// Use a simple paragraph
|
154
|
+
if ( $( elem ).children().length !== 0 ) {
|
155
|
+
|
156
|
+
// Use the contents function to retrieve the caption
|
157
|
+
$( elem ).contents().filter( function() {
|
158
|
+
|
159
|
+
// Text Node
|
160
|
+
if ( !caption && this.nodeType === 3 ) {
|
161
|
+
|
162
|
+
// Doesn't matter what it is, but this will be
|
163
|
+
// considered as the caption if is not empty
|
164
|
+
caption = $( this ).text().replace( /^\s+|\s+$/g, "" );
|
165
|
+
if ( caption.length !== 0 ) {
|
166
|
+
caption = this;
|
167
|
+
captionFound = true;
|
168
|
+
return;
|
169
|
+
}
|
170
|
+
caption = false;
|
171
|
+
} else if ( !caption && this.nodeType === 1 ) {
|
172
|
+
|
173
|
+
// Doesn't matter what it is, the first children
|
174
|
+
// element will be considered as the caption
|
175
|
+
caption = this;
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
} );
|
179
|
+
|
180
|
+
// Use the children function to retrieve the description
|
181
|
+
$( elem ).children().filter( function() {
|
182
|
+
|
183
|
+
// if the caption is an element, we should ignore the first one
|
184
|
+
if ( captionFound ) {
|
185
|
+
description.push( this );
|
186
|
+
} else {
|
187
|
+
captionFound = true;
|
188
|
+
}
|
189
|
+
} );
|
190
|
+
} else {
|
191
|
+
caption = elem;
|
192
|
+
}
|
193
|
+
|
194
|
+
// Move the description in a wrapper if there is more than one element
|
195
|
+
if ( description.length > 1 ) {
|
196
|
+
groupheadercell.description = $( description );
|
197
|
+
} else if ( description.length === 1 ) {
|
198
|
+
groupheadercell.description = description[ 0 ];
|
199
|
+
}
|
200
|
+
if ( caption ) {
|
201
|
+
groupheadercell.caption = caption;
|
202
|
+
}
|
203
|
+
groupheadercell.groupZero = groupZero;
|
204
|
+
groupheadercell.type = 1;
|
205
|
+
groupZero.groupheadercell = groupheadercell;
|
206
|
+
$( elem ).data().tblparser = groupheadercell;
|
207
|
+
}
|
208
|
+
function processColgroup( elem, nbvirtualcol ) {
|
209
|
+
|
210
|
+
// if elem is undefined, this mean that is an big empty colgroup
|
211
|
+
// nbvirtualcol if defined is used to create the virtual colgroup
|
212
|
+
var colgroup = {
|
213
|
+
elem: {},
|
214
|
+
start: 0,
|
215
|
+
end: 0,
|
216
|
+
col: [],
|
217
|
+
groupZero: groupZero
|
218
|
+
},
|
219
|
+
colgroupspan = 0,
|
220
|
+
width, i, iLen, col;
|
221
|
+
colgroup.elem = elem;
|
222
|
+
if ( elem ) {
|
223
|
+
$( elem ).data().tblparser = colgroup;
|
224
|
+
}
|
225
|
+
colgroup.uid = uidElem;
|
226
|
+
uidElem += 1;
|
227
|
+
groupZero.allParserObj.push( colgroup );
|
228
|
+
if ( colgroupFrame.length !== 0 ) {
|
229
|
+
colgroup.start = colgroupFrame[ colgroupFrame.length - 1 ].end + 1;
|
230
|
+
} else {
|
231
|
+
colgroup.start = 1;
|
232
|
+
}
|
233
|
+
|
234
|
+
// Add any exist structural col element
|
235
|
+
if ( elem ) {
|
236
|
+
$( "col", elem ).each( function() {
|
237
|
+
var $this = $( this ),
|
238
|
+
width = $this.attr( "span" ) !== undefined ?
|
239
|
+
parseInt( $this.attr( "span" ), 10 ) :
|
240
|
+
1,
|
241
|
+
col = {
|
242
|
+
elem: {},
|
243
|
+
start: 0,
|
244
|
+
end: 0,
|
245
|
+
groupZero: groupZero
|
246
|
+
};
|
247
|
+
col.uid = uidElem;
|
248
|
+
uidElem += 1;
|
249
|
+
groupZero.allParserObj.push( col );
|
250
|
+
col.start = colgroup.start + colgroupspan;
|
251
|
+
|
252
|
+
// Minus one because the default value was already calculated
|
253
|
+
col.end = colgroup.start + colgroupspan + width - 1;
|
254
|
+
col.elem = this;
|
255
|
+
col.groupZero = groupZero;
|
256
|
+
$this.data().tblparser = col;
|
257
|
+
colgroup.col.push( col );
|
258
|
+
columnFrame.push( col );
|
259
|
+
colgroupspan += width;
|
260
|
+
} );
|
261
|
+
}
|
262
|
+
|
263
|
+
// If no col element check for the span attribute
|
264
|
+
if ( colgroup.col.length === 0 ) {
|
265
|
+
if ( elem ) {
|
266
|
+
width = $( elem ).attr( "span" ) !== undefined ?
|
267
|
+
parseInt( $( elem ).attr( "span" ), 10 ) :
|
268
|
+
1;
|
269
|
+
} else if ( typeof nbvirtualcol === "number" ) {
|
270
|
+
width = nbvirtualcol;
|
271
|
+
} else {
|
272
|
+
$obj.trigger( {
|
273
|
+
type: errorEvent,
|
274
|
+
pointer: $obj,
|
275
|
+
err: 31
|
276
|
+
} );
|
277
|
+
return;
|
278
|
+
}
|
279
|
+
colgroupspan += width;
|
280
|
+
|
281
|
+
// Create virtual column
|
282
|
+
for ( i = colgroup.start, iLen = ( colgroup.start + colgroupspan ); i !== iLen; i += 1 ) {
|
283
|
+
col = {
|
284
|
+
start: 0,
|
285
|
+
end: 0,
|
286
|
+
groupZero: groupZero,
|
287
|
+
elem: undefined
|
288
|
+
};
|
289
|
+
col.uid = uidElem;
|
290
|
+
uidElem += 1;
|
291
|
+
groupZero.allParserObj.push( col );
|
292
|
+
col.start = i;
|
293
|
+
col.end = i;
|
294
|
+
colgroup.col.push( col );
|
295
|
+
columnFrame.push( col );
|
296
|
+
}
|
297
|
+
}
|
298
|
+
colgroup.end = colgroup.start + colgroupspan - 1;
|
299
|
+
colgroupFrame.push( colgroup );
|
300
|
+
}
|
301
|
+
|
302
|
+
// thead row group processing
|
303
|
+
function processRowgroupHeader( colgroupHeaderColEnd ) {
|
304
|
+
var i, iLen, j, jLen, m, mLen,
|
305
|
+
tmpStack = [], tmpStackCurr, tmpStackCell,
|
306
|
+
dataColgroup, dataColumns, colgroup, col,
|
307
|
+
hcolgroup, currColPos,
|
308
|
+
currColgroupStructure, bigTotalColgroupFound,
|
309
|
+
theadRSNext, theadRSNextCell, cell, gzCol, theadRS;
|
310
|
+
|
311
|
+
if ( groupZero.colgrouphead || rowgroupheadercalled ) {
|
312
|
+
|
313
|
+
// Prevent multiple call
|
314
|
+
return;
|
315
|
+
}
|
316
|
+
rowgroupheadercalled = true;
|
317
|
+
if ( colgroupHeaderColEnd && colgroupHeaderColEnd > 0 ) {
|
318
|
+
|
319
|
+
// The first colgroup must match the colgroupHeaderColEnd
|
320
|
+
if ( colgroupFrame.length > 0 && ( colgroupFrame[ 0 ].start !== 1 ||
|
321
|
+
( colgroupFrame[ 0 ].end !== colgroupHeaderColEnd &&
|
322
|
+
colgroupFrame[ 0 ].end !== ( colgroupHeaderColEnd + 1 ) ) ) ) {
|
323
|
+
|
324
|
+
$obj.trigger( {
|
325
|
+
type: warningEvent,
|
326
|
+
pointer: $obj,
|
327
|
+
err: 3
|
328
|
+
} );
|
329
|
+
|
330
|
+
// Destroy any existing colgroup, because they are not valid
|
331
|
+
colgroupFrame = [];
|
332
|
+
}
|
333
|
+
} else {
|
334
|
+
|
335
|
+
// This mean that are no colgroup designated to be a colgroup header
|
336
|
+
colgroupHeaderColEnd = 0;
|
337
|
+
}
|
338
|
+
|
339
|
+
// Associate any descriptive cell to his top header
|
340
|
+
for ( i = 0, iLen = theadRowStack.length; i !== iLen; i += 1 ) {
|
341
|
+
theadRS = theadRowStack[ i ];
|
342
|
+
if ( !theadRS.type ) {
|
343
|
+
theadRS.type = 1;
|
344
|
+
}
|
345
|
+
|
346
|
+
for ( j = 0, jLen = theadRS.cell.length; j < jLen; j += 1 ) {
|
347
|
+
cell = theadRowStack[ i ].cell[ j ];
|
348
|
+
cell.scope = "col";
|
349
|
+
|
350
|
+
// check if we have a layout cell at the top, left
|
351
|
+
if ( i === 0 && j === 0 && cell.elem.innerHTML.length === 0 ) {
|
352
|
+
|
353
|
+
// That is a layout cell
|
354
|
+
cell.type = 6;
|
355
|
+
if ( !groupZero.layoutCell ) {
|
356
|
+
groupZero.layoutCell = [];
|
357
|
+
}
|
358
|
+
groupZero.layoutCell.push( cell );
|
359
|
+
|
360
|
+
j = cell.width - 1;
|
361
|
+
if ( j >= jLen ) {
|
362
|
+
break;
|
363
|
+
}
|
364
|
+
}
|
365
|
+
|
366
|
+
// Check the next row to see if they have a corresponding description cell
|
367
|
+
theadRSNext = theadRowStack[ i + 1 ];
|
368
|
+
theadRSNextCell = theadRSNext ? theadRSNext.cell[ j ] : "";
|
369
|
+
if ( !cell.descCell &&
|
370
|
+
cell.elem.nodeName.toLowerCase() === "th" &&
|
371
|
+
!cell.type &&
|
372
|
+
theadRSNext &&
|
373
|
+
theadRSNext.uid !== cell.uid &&
|
374
|
+
theadRSNextCell &&
|
375
|
+
!theadRSNextCell.type &&
|
376
|
+
theadRSNextCell.elem.nodeName.toLowerCase() === "td" &&
|
377
|
+
theadRSNextCell.width === cell.width &&
|
378
|
+
theadRSNextCell.height === 1 ) {
|
379
|
+
|
380
|
+
// Mark the next row as a row description
|
381
|
+
theadRSNext.type = 5;
|
382
|
+
|
383
|
+
// Mark the cell as a cell description
|
384
|
+
theadRSNextCell.type = 5;
|
385
|
+
theadRSNextCell.row = theadRS;
|
386
|
+
cell.descCell = theadRSNextCell;
|
387
|
+
|
388
|
+
// Add the description cell to the complete listing
|
389
|
+
if ( !groupZero.desccell ) {
|
390
|
+
groupZero.desccell = [];
|
391
|
+
}
|
392
|
+
groupZero.desccell.push( theadRSNextCell );
|
393
|
+
|
394
|
+
j = cell.width - 1;
|
395
|
+
if ( j >= jLen ) {
|
396
|
+
break;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
if ( !cell.type ) {
|
401
|
+
cell.type = 1;
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
|
406
|
+
// Clean the theadRowStack by removing any descriptive row
|
407
|
+
for ( i = 0, iLen = theadRowStack.length; i !== iLen; i += 1 ) {
|
408
|
+
theadRS = theadRowStack[ i ];
|
409
|
+
if ( theadRS.type === 5 ) {
|
410
|
+
|
411
|
+
// Check if all the cell in it are set to the type 5
|
412
|
+
for ( j = 0, jLen = theadRS.cell.length; j !== jLen; j += 1 ) {
|
413
|
+
cell = theadRS.cell[ j ];
|
414
|
+
if ( cell.type !== 5 && cell.type !== 6 && cell.height === 1 ) {
|
415
|
+
$obj.trigger( {
|
416
|
+
type: warningEvent,
|
417
|
+
pointer: cell.elem,
|
418
|
+
err: 4
|
419
|
+
} );
|
420
|
+
}
|
421
|
+
|
422
|
+
// Check the row before and modify their height value
|
423
|
+
if ( cell.uid === theadRowStack[ i - 1 ].cell[ j ].uid ) {
|
424
|
+
cell.height -= 1;
|
425
|
+
}
|
426
|
+
}
|
427
|
+
groupZero.nbDescriptionRow += 1;
|
428
|
+
} else {
|
429
|
+
tmpStack.push( theadRS );
|
430
|
+
}
|
431
|
+
}
|
432
|
+
|
433
|
+
// Array based on level as indexes for columns and group headers
|
434
|
+
groupZero.colgrp = [];
|
435
|
+
|
436
|
+
// Parser any cell in the colgroup header
|
437
|
+
if ( colgroupHeaderColEnd > 0 &&
|
438
|
+
( colgroupFrame.length === 1 || colgroupFrame.length === 0 ) ) {
|
439
|
+
|
440
|
+
// There are no colgroup elements defined.
|
441
|
+
// All cells will be considered to be a data cells.
|
442
|
+
// Data Colgroup
|
443
|
+
dataColgroup = {};
|
444
|
+
dataColumns = [];
|
445
|
+
colgroup = {
|
446
|
+
start: ( colgroupHeaderColEnd + 1 ),
|
447
|
+
end: tableCellWidth,
|
448
|
+
col: [],
|
449
|
+
groupZero: groupZero,
|
450
|
+
elem: undefined,
|
451
|
+
|
452
|
+
// Set colgroup data type
|
453
|
+
type: 2
|
454
|
+
};
|
455
|
+
colgroup.uid = uidElem;
|
456
|
+
uidElem += 1;
|
457
|
+
groupZero.allParserObj.push( colgroup );
|
458
|
+
|
459
|
+
if ( colgroup.start > colgroup.end ) {
|
460
|
+
$obj.trigger( {
|
461
|
+
type: warningEvent,
|
462
|
+
pointer: $obj,
|
463
|
+
err: 5
|
464
|
+
} );
|
465
|
+
}
|
466
|
+
|
467
|
+
dataColgroup = colgroup;
|
468
|
+
|
469
|
+
// Create the column
|
470
|
+
// Create virtual column
|
471
|
+
for ( i = colgroup.start, iLen = colgroup.end; i <= iLen; i += 1 ) {
|
472
|
+
col = {
|
473
|
+
start: 0,
|
474
|
+
end: 0,
|
475
|
+
groupZero: groupZero,
|
476
|
+
elem: undefined
|
477
|
+
};
|
478
|
+
col.uid = uidElem;
|
479
|
+
uidElem += 1;
|
480
|
+
groupZero.allParserObj.push( col );
|
481
|
+
|
482
|
+
if ( !groupZero.col ) {
|
483
|
+
groupZero.col = [];
|
484
|
+
}
|
485
|
+
dataColumns.push( col );
|
486
|
+
|
487
|
+
col.start = i;
|
488
|
+
col.end = i;
|
489
|
+
col.groupstruct = colgroup;
|
490
|
+
|
491
|
+
colgroup.col.push( col );
|
492
|
+
|
493
|
+
// Check to remove "columnFrame"
|
494
|
+
columnFrame.push( col );
|
495
|
+
}
|
496
|
+
|
497
|
+
// Default Level => 1
|
498
|
+
groupZero.colgrp[ 1 ] = [];
|
499
|
+
groupZero.colgrp[ 1 ].push( groupZero.colcaption );
|
500
|
+
|
501
|
+
// Header Colgroup
|
502
|
+
if ( colgroupHeaderColEnd > 0 ) {
|
503
|
+
hcolgroup = {
|
504
|
+
start: 1,
|
505
|
+
elem: undefined,
|
506
|
+
end: colgroupHeaderColEnd,
|
507
|
+
col: [],
|
508
|
+
groupZero: groupZero,
|
509
|
+
|
510
|
+
// Set colgroup data type
|
511
|
+
type: 1
|
512
|
+
};
|
513
|
+
hcolgroup.uid = uidElem;
|
514
|
+
uidElem += 1;
|
515
|
+
groupZero.allParserObj.push( hcolgroup );
|
516
|
+
|
517
|
+
colgroupFrame.push( hcolgroup );
|
518
|
+
colgroupFrame.push( dataColgroup );
|
519
|
+
groupZero.colcaption.dataset = dataColgroup.col;
|
520
|
+
|
521
|
+
// Create the column
|
522
|
+
// Create virtual column
|
523
|
+
for ( i = hcolgroup.start, iLen = hcolgroup.end; i <= iLen; i += 1 ) {
|
524
|
+
col = {
|
525
|
+
start: 0,
|
526
|
+
end: 0,
|
527
|
+
groupZero: groupZero,
|
528
|
+
elem: undefined
|
529
|
+
};
|
530
|
+
col.uid = uidElem;
|
531
|
+
uidElem += 1;
|
532
|
+
groupZero.allParserObj.push( col );
|
533
|
+
|
534
|
+
if ( !groupZero.col ) {
|
535
|
+
groupZero.col = [];
|
536
|
+
}
|
537
|
+
groupZero.col.push( col );
|
538
|
+
|
539
|
+
col.start = i;
|
540
|
+
col.end = i;
|
541
|
+
col.groupstruct = hcolgroup;
|
542
|
+
|
543
|
+
hcolgroup.col.push( col );
|
544
|
+
columnFrame.push( col );
|
545
|
+
}
|
546
|
+
|
547
|
+
for ( i = 0, iLen = dataColumns.length; i !== iLen; i += 1 ) {
|
548
|
+
groupZero.col.push( dataColumns[ i ] );
|
549
|
+
}
|
550
|
+
}
|
551
|
+
|
552
|
+
if ( colgroupFrame.length === 0 ) {
|
553
|
+
colgroupFrame.push( dataColgroup );
|
554
|
+
groupZero.colcaption.dataset = dataColgroup.col;
|
555
|
+
}
|
556
|
+
|
557
|
+
// Set the header for each column
|
558
|
+
for ( i = 0, iLen = groupZero.col.length; i !== iLen; i += 1 ) {
|
559
|
+
gzCol = groupZero.col[ i ];
|
560
|
+
gzCol.header = [];
|
561
|
+
for ( j = 0, jLen = tmpStack.length; j !== jLen; j += 1 ) {
|
562
|
+
for ( m = gzCol.start, mLen = gzCol.end; m <= mLen; m += 1 ) {
|
563
|
+
cell = tmpStack[ j ].cell[ m - 1 ];
|
564
|
+
if ( ( j === 0 || ( j > 0 &&
|
565
|
+
cell.uid !== tmpStack[ j - 1 ].cell[ m - 1 ].uid ) ) &&
|
566
|
+
cell.type === 1 ) {
|
567
|
+
|
568
|
+
gzCol.header.push( cell );
|
569
|
+
}
|
570
|
+
}
|
571
|
+
}
|
572
|
+
}
|
573
|
+
} else {
|
574
|
+
|
575
|
+
// They exist colgroup element,
|
576
|
+
//
|
577
|
+
// -----------------------------------------------------
|
578
|
+
//
|
579
|
+
// Build data column group based on the data column group and summary column group.
|
580
|
+
//
|
581
|
+
// Suggestion: In the future, may be allow the use of a HTML5 data or CSS Option to force a colgroup to be a data group instead of a summary group
|
582
|
+
//
|
583
|
+
// -----------------------------------------------------
|
584
|
+
//
|
585
|
+
// List of real colgroup
|
586
|
+
currColPos = (
|
587
|
+
colgroupHeaderColEnd === 0 ?
|
588
|
+
1 :
|
589
|
+
|
590
|
+
// Set the current column position
|
591
|
+
colgroupFrame[ 0 ].end + 1
|
592
|
+
);
|
593
|
+
|
594
|
+
colgroup = {
|
595
|
+
start: currColPos,
|
596
|
+
end: undefined,
|
597
|
+
col: [],
|
598
|
+
row: [],
|
599
|
+
|
600
|
+
// Set colgroup data type, that is the initial colgroup type
|
601
|
+
type: 2
|
602
|
+
};
|
603
|
+
currColgroupStructure = [];
|
604
|
+
bigTotalColgroupFound = false;
|
605
|
+
|
606
|
+
$.each( colgroupFrame, function() {
|
607
|
+
var curColgroupFrame = this,
|
608
|
+
groupLevel,
|
609
|
+
cgrp,
|
610
|
+
parentHeader,
|
611
|
+
summaryAttached;
|
612
|
+
|
613
|
+
if ( bigTotalColgroupFound || groupZero.colgrp[ 0 ] ) {
|
614
|
+
$obj.trigger( {
|
615
|
+
type: errorEvent,
|
616
|
+
pointer: curColgroupFrame,
|
617
|
+
err: 6
|
618
|
+
} );
|
619
|
+
return;
|
620
|
+
}
|
621
|
+
|
622
|
+
$.each( curColgroupFrame.col, function() {
|
623
|
+
var column = this;
|
624
|
+
if ( !groupZero.col ) {
|
625
|
+
groupZero.col = [];
|
626
|
+
}
|
627
|
+
groupZero.col.push( column );
|
628
|
+
|
629
|
+
column.type = 1;
|
630
|
+
column.groupstruct = curColgroupFrame;
|
631
|
+
} );
|
632
|
+
|
633
|
+
if ( curColgroupFrame.start < currColPos ) {
|
634
|
+
if ( colgroupHeaderColEnd !== curColgroupFrame.end ) {
|
635
|
+
$obj.trigger( {
|
636
|
+
type: warningEvent,
|
637
|
+
pointer: curColgroupFrame,
|
638
|
+
err: 7
|
639
|
+
} );
|
640
|
+
}
|
641
|
+
|
642
|
+
// Skip this colgroup, this should happened only once and should represent the header colgroup
|
643
|
+
|
644
|
+
// Assign the headers for this group
|
645
|
+
for ( i = 0, iLen = curColgroupFrame.col.length; i !== iLen; i += 1 ) {
|
646
|
+
gzCol = curColgroupFrame.col[ i ];
|
647
|
+
gzCol.header = [];
|
648
|
+
for ( j = 0, jLen = tmpStack.length; j !== jLen; j += 1 ) {
|
649
|
+
for ( m = gzCol.start, mLen = gzCol.end; m <= mLen; m += 1 ) {
|
650
|
+
if ( ( j === 0 || ( j > 0 &&
|
651
|
+
tmpStack[ j ].cell[ m - 1 ].uid !== tmpStack[ j - 1 ].cell[ m - 1 ].uid ) ) &&
|
652
|
+
tmpStack[ j ].cell[ m - 1 ].type === 1 ) {
|
653
|
+
gzCol.header.push( tmpStack[ j ].cell[ m - 1 ] );
|
654
|
+
}
|
655
|
+
}
|
656
|
+
}
|
657
|
+
}
|
658
|
+
|
659
|
+
return;
|
660
|
+
}
|
661
|
+
|
662
|
+
groupLevel = undefined;
|
663
|
+
|
664
|
+
// Get the colgroup level
|
665
|
+
for ( i = 0, iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
666
|
+
tmpStackCell = tmpStack[ i ].cell[ curColgroupFrame.end - 1 ];
|
667
|
+
if ( !tmpStackCell && curColgroupFrame.end > tmpStack[ i ].cell.length ) {
|
668
|
+
|
669
|
+
// Number of column are not corresponding to the table width
|
670
|
+
$obj.trigger( {
|
671
|
+
type: warningEvent,
|
672
|
+
pointer: $obj,
|
673
|
+
err: 3
|
674
|
+
} );
|
675
|
+
break;
|
676
|
+
}
|
677
|
+
if ( ( tmpStackCell.colpos + tmpStackCell.width - 1 ) === curColgroupFrame.end &&
|
678
|
+
( tmpStackCell.colpos >= curColgroupFrame.start ) ) {
|
679
|
+
|
680
|
+
if ( !groupLevel || groupLevel > ( i + 1 ) ) {
|
681
|
+
|
682
|
+
// would equal at the current data cell level.
|
683
|
+
// The lowest row level wins.
|
684
|
+
groupLevel = ( i + 1 );
|
685
|
+
}
|
686
|
+
}
|
687
|
+
}
|
688
|
+
|
689
|
+
if ( !groupLevel ) {
|
690
|
+
|
691
|
+
// Default colgroup data Level, this happen when there
|
692
|
+
// is no column header (same as no thead).
|
693
|
+
groupLevel = 1;
|
694
|
+
}
|
695
|
+
|
696
|
+
// All the cells at higher level (below the group level found)
|
697
|
+
// of which one found, need to be inside the colgroup
|
698
|
+
for ( i = ( groupLevel - 1 ), iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
699
|
+
tmpStackCurr = tmpStack[ i ];
|
700
|
+
|
701
|
+
// Test each cell in that group
|
702
|
+
for ( j = curColgroupFrame.start - 1, jLen = curColgroupFrame.end; j !== jLen; j += 1 ) {
|
703
|
+
tmpStackCell = tmpStackCurr.cell[ j ];
|
704
|
+
if ( tmpStackCell.colpos < curColgroupFrame.start ||
|
705
|
+
( tmpStackCell.colpos + tmpStackCell.width - 1 ) > curColgroupFrame.end ) {
|
706
|
+
|
707
|
+
$obj.trigger( {
|
708
|
+
type: errorEvent,
|
709
|
+
pointer: $obj,
|
710
|
+
err: 9
|
711
|
+
} );
|
712
|
+
return;
|
713
|
+
}
|
714
|
+
}
|
715
|
+
}
|
716
|
+
|
717
|
+
// Add virtual colgroup Based on the top header
|
718
|
+
for ( i = currColgroupStructure.length, iLen = ( groupLevel - 1 ); i !== iLen; i += 1 ) {
|
719
|
+
tmpStackCell = tmpStack[ i ].cell[ curColgroupFrame.start - 1 ];
|
720
|
+
|
721
|
+
// Use the top cell at level minus 1, that cell must be larger
|
722
|
+
if ( tmpStackCell.uid !== tmpStack[ i ].cell[ curColgroupFrame.end - 1 ].uid ||
|
723
|
+
tmpStackCell.colpos > curColgroupFrame.start ||
|
724
|
+
tmpStackCell.colpos + tmpStackCell.width - 1 < curColgroupFrame.end ) {
|
725
|
+
$obj.trigger( {
|
726
|
+
type: errorEvent,
|
727
|
+
pointer: $obj,
|
728
|
+
err: 10
|
729
|
+
} );
|
730
|
+
return;
|
731
|
+
}
|
732
|
+
|
733
|
+
// Convert the header in a group header cell
|
734
|
+
cgrp = tmpStackCell;
|
735
|
+
cgrp.level = i + 1;
|
736
|
+
|
737
|
+
cgrp.start = cgrp.colpos;
|
738
|
+
cgrp.end = cgrp.colpos + cgrp.width - 1;
|
739
|
+
|
740
|
+
// Group header cell
|
741
|
+
cgrp.type = 7;
|
742
|
+
|
743
|
+
currColgroupStructure.push( cgrp );
|
744
|
+
|
745
|
+
if ( !groupZero.virtualColgroup ) {
|
746
|
+
groupZero.virtualColgroup = [];
|
747
|
+
}
|
748
|
+
groupZero.virtualColgroup.push( cgrp );
|
749
|
+
|
750
|
+
// Add the group into the level colgroup perspective
|
751
|
+
if ( !groupZero.colgrp[ i + 1 ] ) {
|
752
|
+
groupZero.colgrp[ i + 1 ] = [];
|
753
|
+
}
|
754
|
+
groupZero.colgrp[ i + 1 ].push( cgrp );
|
755
|
+
}
|
756
|
+
|
757
|
+
// Set the header list for the current group
|
758
|
+
curColgroupFrame.header = [];
|
759
|
+
for ( i = groupLevel - ( groupLevel >= 2 ? 2 : 1 ), iLen = tmpStack.length; i !== iLen; i += 1 ) {
|
760
|
+
for ( j = curColgroupFrame.start; j <= curColgroupFrame.end; j += 1 ) {
|
761
|
+
if ( tmpStack[ i ].cell[ j - 1 ].rowpos === i + 1 ) {
|
762
|
+
curColgroupFrame.header.push( tmpStack[ i ].cell[ j - 1 ] );
|
763
|
+
|
764
|
+
// Attach the current colgroup to this header
|
765
|
+
tmpStack[ i ].cell[ j - 1 ].colgroup = curColgroupFrame;
|
766
|
+
}
|
767
|
+
j += tmpStack[ i ].cell[ j - 1 ].width - 1;
|
768
|
+
}
|
769
|
+
}
|
770
|
+
|
771
|
+
// Assign the parent header to the current header
|
772
|
+
parentHeader = [];
|
773
|
+
for ( i = 0; i < currColgroupStructure.length - 1; i += 1 ) {
|
774
|
+
parentHeader.push( currColgroupStructure[ i ] );
|
775
|
+
}
|
776
|
+
curColgroupFrame.parentHeader = parentHeader;
|
777
|
+
|
778
|
+
// Check to set if this group are a data group
|
779
|
+
if ( currColgroupStructure.length < groupLevel ) {
|
780
|
+
|
781
|
+
// This colgroup are a data colgroup
|
782
|
+
// The current colgroup are a data colgroup
|
783
|
+
if ( !curColgroupFrame.type ) {
|
784
|
+
curColgroupFrame.type = 2;
|
785
|
+
|
786
|
+
// Set Data group type
|
787
|
+
curColgroupFrame.level = groupLevel;
|
788
|
+
}
|
789
|
+
|
790
|
+
currColgroupStructure.push( curColgroupFrame );
|
791
|
+
|
792
|
+
// Add the group into the level colgroup perspective
|
793
|
+
if ( !groupZero.colgrp[ groupLevel ] ) {
|
794
|
+
groupZero.colgrp[ groupLevel ] = [];
|
795
|
+
}
|
796
|
+
groupZero.colgrp[ groupLevel ].push( curColgroupFrame );
|
797
|
+
}
|
798
|
+
|
799
|
+
//
|
800
|
+
// Preparing the current stack for the next colgroup and set if the current are a summary group
|
801
|
+
//
|
802
|
+
|
803
|
+
// Check if we need to pop out the current header colgroup
|
804
|
+
summaryAttached = false;
|
805
|
+
for ( i = currColgroupStructure.length - 1; i !== -1; i -= 1 ) {
|
806
|
+
|
807
|
+
if ( currColgroupStructure[ i ].end <= curColgroupFrame.end ) {
|
808
|
+
|
809
|
+
if ( currColgroupStructure[ i ].level < groupLevel && theadRowStack.length > 0 ) {
|
810
|
+
curColgroupFrame.type = 3;
|
811
|
+
}
|
812
|
+
|
813
|
+
// Attach the Summary group to the colgroup
|
814
|
+
// popped if current colgroup are type 3
|
815
|
+
if ( curColgroupFrame.type === 3 && !summaryAttached ) {
|
816
|
+
currColgroupStructure[ currColgroupStructure.length - 1 ].summary = curColgroupFrame;
|
817
|
+
|
818
|
+
// This are used to do not attach a summary of level 4
|
819
|
+
// to an inappropriate level 1 for example
|
820
|
+
summaryAttached = true;
|
821
|
+
}
|
822
|
+
|
823
|
+
currColgroupStructure.pop();
|
824
|
+
}
|
825
|
+
}
|
826
|
+
|
827
|
+
if ( !hassumMode ) {
|
828
|
+
curColgroupFrame.type = 2;
|
829
|
+
}
|
830
|
+
|
831
|
+
// Catch the second and the third possible grouping at level 1
|
832
|
+
if ( groupLevel === 1 && groupZero.colgrp[ 1 ] &&
|
833
|
+
groupZero.colgrp[ 1 ].length > 1 && theadRowStack.length > 0 ) {
|
834
|
+
|
835
|
+
// Check if in the group at level 1 if
|
836
|
+
// we don't already have a summary colgroup
|
837
|
+
for ( i = 0; i < groupZero.colgrp[ 1 ].length; i += 1 ) {
|
838
|
+
if ( groupZero.colgrp[ 1 ][ i ].type === 3 ) {
|
839
|
+
|
840
|
+
// Congrats, we found the last possible colgroup,
|
841
|
+
curColgroupFrame.level = 0;
|
842
|
+
if ( !groupZero.colgrp[ 0 ] ) {
|
843
|
+
groupZero.colgrp[ 0 ] = [];
|
844
|
+
}
|
845
|
+
groupZero.colgrp[ 0 ].push( curColgroupFrame );
|
846
|
+
groupZero.colgrp[ 1 ].pop();
|
847
|
+
|
848
|
+
bigTotalColgroupFound = true;
|
849
|
+
break;
|
850
|
+
}
|
851
|
+
}
|
852
|
+
if ( hassumMode ) {
|
853
|
+
curColgroupFrame.type = 3;
|
854
|
+
}
|
855
|
+
}
|
856
|
+
|
857
|
+
// Set the representative header "caption" element for a group at level 0
|
858
|
+
if ( curColgroupFrame.level === 1 && curColgroupFrame.type === 2 ) {
|
859
|
+
curColgroupFrame.repheader = "caption";
|
860
|
+
}
|
861
|
+
|
862
|
+
if ( !groupZero.col ) {
|
863
|
+
groupZero.col = [];
|
864
|
+
}
|
865
|
+
|
866
|
+
$.each( curColgroupFrame.col, function() {
|
867
|
+
var column = this,
|
868
|
+
colStart = column.start,
|
869
|
+
colEnd = column.end,
|
870
|
+
colpos, cellWidth, cell, colHeaderLen;
|
871
|
+
|
872
|
+
column.type = curColgroupFrame.type;
|
873
|
+
column.level = curColgroupFrame.level;
|
874
|
+
column.groupstruct = curColgroupFrame;
|
875
|
+
|
876
|
+
column.header = [];
|
877
|
+
|
878
|
+
// Find the lowest header that would represent this column
|
879
|
+
for ( j = ( groupLevel - 1 ); j < tmpStack.length; j += 1 ) {
|
880
|
+
for ( i = ( curColgroupFrame.start - 1 ); i < curColgroupFrame.end; i += 1 ) {
|
881
|
+
cell = tmpStack[ j ].cell[ i ];
|
882
|
+
colpos = cell.colpos;
|
883
|
+
cellWidth = cell.width - 1;
|
884
|
+
if ( ( colpos >= colStart && colpos <= colEnd ) ||
|
885
|
+
( colpos <= colStart &&
|
886
|
+
( colpos + cellWidth ) >= colEnd ) ||
|
887
|
+
( ( colpos + cellWidth ) <= colStart &&
|
888
|
+
( colpos + cellWidth ) >= colEnd ) ) {
|
889
|
+
|
890
|
+
colHeaderLen = column.header.length;
|
891
|
+
if ( colHeaderLen === 0 || ( colHeaderLen > 0 && column.header[ colHeaderLen - 1 ].uid !== cell.uid ) ) {
|
892
|
+
|
893
|
+
// This are the header that would represent this column
|
894
|
+
column.header.push( cell );
|
895
|
+
tmpStack[ j ].cell[ i ].level = curColgroupFrame.level;
|
896
|
+
}
|
897
|
+
}
|
898
|
+
}
|
899
|
+
}
|
900
|
+
} );
|
901
|
+
} );
|
902
|
+
|
903
|
+
if ( !groupZero.virtualColgroup ) {
|
904
|
+
groupZero.virtualColgroup = [];
|
905
|
+
}
|
906
|
+
|
907
|
+
// Set the Virtual Group Header Cell, if any
|
908
|
+
$.each( groupZero.virtualColgroup, function() {
|
909
|
+
var vGroupHeaderCell = this;
|
910
|
+
|
911
|
+
// Set the headerLevel at the appropriate column
|
912
|
+
for ( i = ( vGroupHeaderCell.start - 1 ); i < vGroupHeaderCell.end; i += 1 ) {
|
913
|
+
if ( !groupZero.col[ i ].headerLevel ) {
|
914
|
+
groupZero.col[ i ].headerLevel = [];
|
915
|
+
}
|
916
|
+
groupZero.col[ i ].headerLevel.push( vGroupHeaderCell );
|
917
|
+
}
|
918
|
+
} );
|
919
|
+
}
|
920
|
+
|
921
|
+
// Associate the colgroup Header in the group Zero
|
922
|
+
if ( colgroupFrame.length > 0 && colgroupHeaderColEnd > 0 ) {
|
923
|
+
groupZero.colgrouphead = colgroupFrame[ 0 ];
|
924
|
+
|
925
|
+
// Set the first colgroup type :-)
|
926
|
+
groupZero.colgrouphead.type = 1;
|
927
|
+
}
|
928
|
+
}
|
929
|
+
|
930
|
+
function finalizeRowGroup() {
|
931
|
+
|
932
|
+
// Check if the current rowgroup has been go in the rowgroup setup, if not we do
|
933
|
+
if ( !currentRowGroup.type || !currentRowGroup.level ) {
|
934
|
+
|
935
|
+
// Colgroup Setup,
|
936
|
+
rowgroupSetup();
|
937
|
+
}
|
938
|
+
|
939
|
+
// If the current row group are a data group, check each row if we can found a pattern about to increment the data level for this row group
|
940
|
+
// Update, if needed, each row and cell to take in consideration the new row group level
|
941
|
+
// Add the row group in the groupZero Collection
|
942
|
+
lstRowGroup.push( currentRowGroup );
|
943
|
+
currentRowGroup = {};
|
944
|
+
}
|
945
|
+
|
946
|
+
function initiateRowGroup() {
|
947
|
+
|
948
|
+
// Finalisation of any existing row group
|
949
|
+
if ( currentRowGroup && currentRowGroup.type ) {
|
950
|
+
finalizeRowGroup();
|
951
|
+
}
|
952
|
+
|
953
|
+
// Initialisation of the a new row group
|
954
|
+
currentRowGroup = {};
|
955
|
+
currentRowGroup.elem = currentRowGroupElement;
|
956
|
+
currentRowGroup.row = [];
|
957
|
+
currentRowGroup.headerlevel = [];
|
958
|
+
currentRowGroup.groupZero = groupZero;
|
959
|
+
currentRowGroup.uid = uidElem;
|
960
|
+
uidElem += 1;
|
961
|
+
}
|
962
|
+
|
963
|
+
function rowgroupSetup( forceDataGroup ) {
|
964
|
+
|
965
|
+
var i, iLen, previousRowGroup, tmpHeaderLevel;
|
966
|
+
|
967
|
+
if ( tfootOnProcess ) {
|
968
|
+
currentRowGroup.type = 3;
|
969
|
+
currentRowGroup.level = 0;
|
970
|
+
rowgroupHeaderRowStack = [];
|
971
|
+
return;
|
972
|
+
}
|
973
|
+
|
974
|
+
// Check if the current row group, already have some row,
|
975
|
+
// if yes this is a new row group
|
976
|
+
if ( rowgroupHeaderRowStack.length !== 0 ) {
|
977
|
+
|
978
|
+
// if more than 0 cell in the stack, mark this row group as a data
|
979
|
+
// row group and create the new row group (can be only virtual)
|
980
|
+
if ( currentRowGroup && currentRowGroup.type &&
|
981
|
+
currentRowGroup.row.length > 0 ) {
|
982
|
+
|
983
|
+
currentRowGroupElement = {};
|
984
|
+
initiateRowGroup();
|
985
|
+
}
|
986
|
+
|
987
|
+
// We have a data row group
|
988
|
+
currentRowGroup.type = 2;
|
989
|
+
|
990
|
+
// Set the group header cell
|
991
|
+
currentRowGroup.row = rowgroupHeaderRowStack;
|
992
|
+
for ( i = 0, iLen = rowgroupHeaderRowStack.length; i !== iLen; i += 1 ) {
|
993
|
+
rowgroupHeaderRowStack[ i ].cell[ 0 ].type = 7;
|
994
|
+
rowgroupHeaderRowStack[ i ].cell[ 0 ].scope = "row";
|
995
|
+
rowgroupHeaderRowStack[ i ].cell[ 0 ].row = rowgroupHeaderRowStack[ i ];
|
996
|
+
currentRowGroup.headerlevel.push( rowgroupHeaderRowStack[ i ].cell[ 0 ] );
|
997
|
+
}
|
998
|
+
}
|
999
|
+
|
1000
|
+
// if no cell in the stack but first row group, mark this row group as a data row group
|
1001
|
+
if ( rowgroupHeaderRowStack.length === 0 && lstRowGroup.length === 0 ) {
|
1002
|
+
|
1003
|
+
if ( currentRowGroup.type && currentRowGroup.type === 1 ) {
|
1004
|
+
currentRowGroupElement = {};
|
1005
|
+
initiateRowGroup();
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
// This is the first data row group at level 1
|
1009
|
+
currentRowGroup.type = 2;
|
1010
|
+
|
1011
|
+
// Default row group level
|
1012
|
+
currentRowGroup.level = 1;
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
// if no cell in the stack and not the first row group, this are a summary group
|
1016
|
+
// This is only valid if the first colgroup is a header colgroup.
|
1017
|
+
if ( rowgroupHeaderRowStack.length === 0 && lstRowGroup.length > 0 &&
|
1018
|
+
!currentRowGroup.type && colgroupFrame[ 0 ] &&
|
1019
|
+
( colgroupFrame[ 0 ].type === 1 || ( !colgroupFrame[ 0 ].type && colgroupFrame.length > 0 ) ) &&
|
1020
|
+
!forceDataGroup ) {
|
1021
|
+
|
1022
|
+
currentRowGroup.type = 3;
|
1023
|
+
} else {
|
1024
|
+
currentRowGroup.type = 2;
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
if ( currentRowGroup.type === 3 && !hassumMode ) {
|
1028
|
+
currentRowGroup.type = 2;
|
1029
|
+
currentRowGroup.level = lstRowGroup[ lstRowGroup.length - 1 ].level;
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
// Set the Data Level for this row group
|
1033
|
+
// Calculate the appropriate row group level based on the previous rowgroup
|
1034
|
+
// * a Summary Group decrease the row group level
|
1035
|
+
// * a Data Group increase the row group level based of his number of row group header and the previous row group level
|
1036
|
+
// * Dont forget to set the appropriate level to each group header cell inside this row group.
|
1037
|
+
if ( !currentRowGroup.level ) {
|
1038
|
+
|
1039
|
+
// Get the level of the previous group
|
1040
|
+
if ( lstRowGroup.length > 0 ) {
|
1041
|
+
previousRowGroup = lstRowGroup[ lstRowGroup.length - 1 ];
|
1042
|
+
|
1043
|
+
if ( currentRowGroup.type === 2 ) {
|
1044
|
+
|
1045
|
+
// Data Group
|
1046
|
+
if ( currentRowGroup.headerlevel.length === previousRowGroup.headerlevel.length ) {
|
1047
|
+
|
1048
|
+
// Same Level as the previous one
|
1049
|
+
currentRowGroup.level = previousRowGroup.level;
|
1050
|
+
} else if ( currentRowGroup.headerlevel.length < previousRowGroup.headerlevel.length ) {
|
1051
|
+
|
1052
|
+
// add the missing group heading cell
|
1053
|
+
tmpHeaderLevel = currentRowGroup.headerlevel;
|
1054
|
+
currentRowGroup.headerlevel = [];
|
1055
|
+
|
1056
|
+
for ( i = 0; i < ( previousRowGroup.headerlevel.length - currentRowGroup.headerlevel.length ); i += 1 ) {
|
1057
|
+
currentRowGroup.headerlevel.push( previousRowGroup.headerlevel[ i ] );
|
1058
|
+
}
|
1059
|
+
for ( i = 0; i < tmpHeaderLevel.length; i += 1 ) {
|
1060
|
+
currentRowGroup.headerlevel.push( tmpHeaderLevel[ i ] );
|
1061
|
+
}
|
1062
|
+
currentRowGroup.level = previousRowGroup.level;
|
1063
|
+
} else if ( currentRowGroup.headerlevel.length > previousRowGroup.headerlevel.length ) {
|
1064
|
+
|
1065
|
+
// This are a new set of heading, the level equal the number of group header cell found
|
1066
|
+
currentRowGroup.level = currentRowGroup.headerlevel.length + 1;
|
1067
|
+
}
|
1068
|
+
} else if ( currentRowGroup.type === 3 ) {
|
1069
|
+
|
1070
|
+
// Summary Group
|
1071
|
+
if ( previousRowGroup.type === 3 ) {
|
1072
|
+
currentRowGroup.level = previousRowGroup.level - 1;
|
1073
|
+
} else {
|
1074
|
+
currentRowGroup.level = previousRowGroup.level;
|
1075
|
+
}
|
1076
|
+
if ( currentRowGroup.level < 0 ) {
|
1077
|
+
|
1078
|
+
// This is an error, Last summary row group was already found.
|
1079
|
+
$obj.trigger( {
|
1080
|
+
type: warningEvent,
|
1081
|
+
pointer: $obj,
|
1082
|
+
err: 12
|
1083
|
+
} );
|
1084
|
+
}
|
1085
|
+
|
1086
|
+
// Set the header level with the previous row group
|
1087
|
+
for ( i = 0; i < previousRowGroup.headerlevel.length; i += 1 ) {
|
1088
|
+
if ( previousRowGroup.headerlevel[ i ].level < currentRowGroup.level ) {
|
1089
|
+
currentRowGroup.headerlevel.push( previousRowGroup.headerlevel[ i ] );
|
1090
|
+
}
|
1091
|
+
}
|
1092
|
+
} else {
|
1093
|
+
|
1094
|
+
// Error
|
1095
|
+
currentRowGroup.level = "Error, not calculated";
|
1096
|
+
$obj.trigger( {
|
1097
|
+
type: warningEvent,
|
1098
|
+
pointer: $obj,
|
1099
|
+
err: 13
|
1100
|
+
} );
|
1101
|
+
}
|
1102
|
+
} else {
|
1103
|
+
currentRowGroup.level = 1 + rowgroupHeaderRowStack.length;
|
1104
|
+
}
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
// Ensure that each row group cell heading have their level set
|
1108
|
+
for ( i = 0; i < currentRowGroup.headerlevel.length; i += 1 ) {
|
1109
|
+
currentRowGroup.headerlevel[ i ].level = i + 1;
|
1110
|
+
currentRowGroup.headerlevel[ i ].rowlevel = currentRowGroup.headerlevel [ i ].level;
|
1111
|
+
}
|
1112
|
+
|
1113
|
+
// reset the row header stack
|
1114
|
+
rowgroupHeaderRowStack = [];
|
1115
|
+
|
1116
|
+
if ( currentRowGroup.level === undefined || currentRowGroup.level < 0 ) {
|
1117
|
+
$obj.trigger( {
|
1118
|
+
type: warningEvent,
|
1119
|
+
pointer: currentRowGroup.elem,
|
1120
|
+
err: 14
|
1121
|
+
} );
|
1122
|
+
}
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
function processRow( elem ) {
|
1126
|
+
|
1127
|
+
// In this function there are a possible confusion about the colgroup variable name used here vs the real colgroup table, In this function the colgroup is used when there are no header cell.
|
1128
|
+
currentRowPos += 1;
|
1129
|
+
var columnPos = 1,
|
1130
|
+
lastCellType = "",
|
1131
|
+
lastHeadingColPos = false,
|
1132
|
+
cells = $( elem ).children(),
|
1133
|
+
row = {
|
1134
|
+
colgroup: [], /* === Build from colgroup object == */
|
1135
|
+
cell: [], /* === Build from Cell Object == */
|
1136
|
+
elem: elem, /* Row Structure jQuery element */
|
1137
|
+
rowpos: currentRowPos
|
1138
|
+
},
|
1139
|
+
colgroup,
|
1140
|
+
fnPreProcessGroupHeaderCell,
|
1141
|
+
fnPreProcessGroupDataCell,
|
1142
|
+
fnParseSpannedRowCell,
|
1143
|
+
headingRowCell,
|
1144
|
+
rowheader,
|
1145
|
+
colKeyCell,
|
1146
|
+
i,
|
1147
|
+
j,
|
1148
|
+
isDataColgroupType;
|
1149
|
+
|
1150
|
+
$( elem ).data().tblparser = row;
|
1151
|
+
|
1152
|
+
row.uid = uidElem;
|
1153
|
+
uidElem += 1;
|
1154
|
+
row.groupZero = groupZero;
|
1155
|
+
groupZero.allParserObj.push( row );
|
1156
|
+
|
1157
|
+
colgroup = {
|
1158
|
+
cell: [],
|
1159
|
+
cgsummary: undefined, /* ?? Not sure because this will be better in the data colgroup object ?? Summary Colgroup Associated */
|
1160
|
+
type: false /* 1 === header, 2 === data, 3 === summary, 4 === key, 5 === description, 6 === layout, 7 === group header */
|
1161
|
+
};
|
1162
|
+
|
1163
|
+
colgroup.uid = uidElem;
|
1164
|
+
uidElem += 1;
|
1165
|
+
groupZero.allParserObj.push( colgroup );
|
1166
|
+
|
1167
|
+
fnPreProcessGroupHeaderCell = function( headerCell ) {
|
1168
|
+
if ( !colgroup.type ) {
|
1169
|
+
colgroup.type = 1;
|
1170
|
+
}
|
1171
|
+
if ( colgroup.type !== 1 ) {
|
1172
|
+
|
1173
|
+
// Creation of a new colgroup
|
1174
|
+
// Add the previous colgroup
|
1175
|
+
row.colgroup.push( colgroup );
|
1176
|
+
|
1177
|
+
// Create a new colgroup
|
1178
|
+
colgroup = {
|
1179
|
+
cell: [],
|
1180
|
+
type: 1
|
1181
|
+
};
|
1182
|
+
colgroup.uid = uidElem;
|
1183
|
+
uidElem += 1;
|
1184
|
+
groupZero.allParserObj.push( colgroup );
|
1185
|
+
}
|
1186
|
+
colgroup.cell.push( headerCell );
|
1187
|
+
lastHeadingColPos = headerCell.colpos + headerCell.width - 1;
|
1188
|
+
};
|
1189
|
+
|
1190
|
+
fnPreProcessGroupDataCell = function( dataCell ) {
|
1191
|
+
if ( !colgroup.type ) {
|
1192
|
+
colgroup.type = 2;
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
// Check if we need to create a summary colgroup (Based on the top colgroup definition)
|
1196
|
+
if ( colgroup.type !== 2 ) {
|
1197
|
+
|
1198
|
+
// Creation of a new colgroup
|
1199
|
+
// Add the previous colgroup
|
1200
|
+
row.colgroup.push( colgroup );
|
1201
|
+
|
1202
|
+
// Create a new colgroup
|
1203
|
+
colgroup = {
|
1204
|
+
cell: [],
|
1205
|
+
type: 2
|
1206
|
+
};
|
1207
|
+
colgroup.uid = uidElem;
|
1208
|
+
uidElem += 1;
|
1209
|
+
groupZero.allParserObj.push( colgroup );
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
colgroup.cell.push( dataCell );
|
1213
|
+
};
|
1214
|
+
|
1215
|
+
fnParseSpannedRowCell = function() {
|
1216
|
+
var j,
|
1217
|
+
currCell;
|
1218
|
+
|
1219
|
+
// Check for spanned row
|
1220
|
+
while ( columnPos <= tableCellWidth ) {
|
1221
|
+
if ( !spannedRow[ columnPos ] ) {
|
1222
|
+
break;
|
1223
|
+
}
|
1224
|
+
currCell = spannedRow[ columnPos ];
|
1225
|
+
|
1226
|
+
if ( currCell.spanHeight && currCell.spanHeight > 0 && currCell.colpos === columnPos ) {
|
1227
|
+
if ( currCell.height + currCell.rowpos - currCell.spanHeight !== currentRowPos ) {
|
1228
|
+
break;
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
lastCellType = currCell.elem.nodeName.toLowerCase();
|
1232
|
+
|
1233
|
+
if ( lastCellType === "th" ) {
|
1234
|
+
fnPreProcessGroupHeaderCell( currCell );
|
1235
|
+
} else if ( lastCellType === "td" ) {
|
1236
|
+
fnPreProcessGroupDataCell( currCell );
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
// Adjust the spanned value for the next check
|
1240
|
+
if ( currCell.spanHeight === 1 ) {
|
1241
|
+
delete currCell.spanHeight;
|
1242
|
+
} else {
|
1243
|
+
currCell.spanHeight -= 1;
|
1244
|
+
}
|
1245
|
+
|
1246
|
+
for ( j = 0; j < currCell.width; j += 1 ) {
|
1247
|
+
row.cell.push( currCell );
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
// Increment the column position
|
1251
|
+
columnPos += currCell.width;
|
1252
|
+
} else {
|
1253
|
+
break;
|
1254
|
+
}
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
};
|
1258
|
+
|
1259
|
+
// Read the row
|
1260
|
+
$.each( cells, function() {
|
1261
|
+
var $this = $( this ),
|
1262
|
+
width = $this.attr( "colspan" ) !== undefined ? parseInt( $this.attr( "colspan" ), 10 ) : 1,
|
1263
|
+
height = $this.attr( "rowspan" ) !== undefined ? parseInt( $this.attr( "rowspan" ), 10 ) : 1,
|
1264
|
+
headerCell,
|
1265
|
+
dataCell,
|
1266
|
+
i;
|
1267
|
+
|
1268
|
+
switch ( this.nodeName.toLowerCase() ) {
|
1269
|
+
|
1270
|
+
// cell header
|
1271
|
+
case "th":
|
1272
|
+
|
1273
|
+
// Check for spanned cell between cells
|
1274
|
+
fnParseSpannedRowCell();
|
1275
|
+
|
1276
|
+
headerCell = {
|
1277
|
+
rowpos: currentRowPos,
|
1278
|
+
colpos: columnPos,
|
1279
|
+
width: width,
|
1280
|
+
height: height,
|
1281
|
+
data: [],
|
1282
|
+
summary: [],
|
1283
|
+
elem: this
|
1284
|
+
};
|
1285
|
+
|
1286
|
+
$this.data().tblparser = headerCell;
|
1287
|
+
headerCell.groupZero = groupZero;
|
1288
|
+
|
1289
|
+
headerCell.uid = uidElem;
|
1290
|
+
uidElem += 1;
|
1291
|
+
groupZero.allParserObj.push( headerCell );
|
1292
|
+
|
1293
|
+
fnPreProcessGroupHeaderCell( headerCell );
|
1294
|
+
|
1295
|
+
headerCell.parent = colgroup;
|
1296
|
+
|
1297
|
+
headerCell.spanHeight = height - 1;
|
1298
|
+
|
1299
|
+
for ( i = 0; i < width; i += 1 ) {
|
1300
|
+
row.cell.push( headerCell );
|
1301
|
+
spannedRow[ columnPos + i ] = headerCell;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
// Increment the column position
|
1305
|
+
columnPos += headerCell.width;
|
1306
|
+
|
1307
|
+
break;
|
1308
|
+
|
1309
|
+
// data cell
|
1310
|
+
case "td":
|
1311
|
+
|
1312
|
+
// Check for spanned cell between cells
|
1313
|
+
fnParseSpannedRowCell();
|
1314
|
+
|
1315
|
+
dataCell = {
|
1316
|
+
rowpos: currentRowPos,
|
1317
|
+
colpos: columnPos,
|
1318
|
+
width: width,
|
1319
|
+
height: height,
|
1320
|
+
elem: this
|
1321
|
+
};
|
1322
|
+
|
1323
|
+
$this.data().tblparser = dataCell;
|
1324
|
+
dataCell.groupZero = groupZero;
|
1325
|
+
|
1326
|
+
dataCell.uid = uidElem;
|
1327
|
+
uidElem += 1;
|
1328
|
+
groupZero.allParserObj.push( dataCell );
|
1329
|
+
|
1330
|
+
fnPreProcessGroupDataCell( dataCell );
|
1331
|
+
|
1332
|
+
dataCell.parent = colgroup;
|
1333
|
+
|
1334
|
+
dataCell.spanHeight = height - 1;
|
1335
|
+
|
1336
|
+
for ( i = 0; i < width; i += 1 ) {
|
1337
|
+
row.cell.push( dataCell );
|
1338
|
+
spannedRow[ columnPos + i ] = dataCell;
|
1339
|
+
}
|
1340
|
+
|
1341
|
+
// Increment the column position
|
1342
|
+
columnPos += dataCell.width;
|
1343
|
+
|
1344
|
+
break;
|
1345
|
+
default:
|
1346
|
+
$obj.trigger( {
|
1347
|
+
type: warningEvent,
|
1348
|
+
pointer: this,
|
1349
|
+
err: 15
|
1350
|
+
} );
|
1351
|
+
break;
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
lastCellType = this.nodeName.toLowerCase();
|
1355
|
+
|
1356
|
+
} );
|
1357
|
+
|
1358
|
+
// Check for any spanned cell
|
1359
|
+
fnParseSpannedRowCell();
|
1360
|
+
|
1361
|
+
// Check if this the number of column for this row are equal to the other
|
1362
|
+
if ( tableCellWidth === 0 ) {
|
1363
|
+
|
1364
|
+
// If not already set, we use the first row as a guideline
|
1365
|
+
tableCellWidth = row.cell.length;
|
1366
|
+
}
|
1367
|
+
if ( tableCellWidth !== row.cell.length ) {
|
1368
|
+
row.spannedRow = spannedRow;
|
1369
|
+
$obj.trigger( {
|
1370
|
+
type: warningEvent,
|
1371
|
+
pointer: row.elem,
|
1372
|
+
err: 16
|
1373
|
+
} );
|
1374
|
+
}
|
1375
|
+
|
1376
|
+
// Check if we are into a thead rowgroup, if yes we stop here.
|
1377
|
+
if ( stackRowHeader ) {
|
1378
|
+
theadRowStack.push( row );
|
1379
|
+
return;
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
// Add the last colgroup
|
1383
|
+
row.colgroup.push( colgroup );
|
1384
|
+
|
1385
|
+
//
|
1386
|
+
// Diggest the row
|
1387
|
+
//
|
1388
|
+
if ( lastCellType === "th" ) {
|
1389
|
+
|
1390
|
+
// Digest the row header
|
1391
|
+
row.type = 1;
|
1392
|
+
|
1393
|
+
//
|
1394
|
+
// Check the validity of this header row
|
1395
|
+
//
|
1396
|
+
|
1397
|
+
if ( row.colgroup.length === 2 && currentRowPos === 1 ) {
|
1398
|
+
|
1399
|
+
// Check if the first is a data colgroup with only one cell
|
1400
|
+
if ( row.colgroup[ 0 ].type === 2 && row.colgroup[ 0 ].cell.length === 1 ) {
|
1401
|
+
|
1402
|
+
// Valid row header for the row group header
|
1403
|
+
|
1404
|
+
// REQUIRED: That cell need to be empty
|
1405
|
+
if ( $( row.colgroup[ 0 ].cell [ 0 ].elem ).html().length === 0 ) {
|
1406
|
+
|
1407
|
+
// We stack the row
|
1408
|
+
theadRowStack.push( row );
|
1409
|
+
|
1410
|
+
// We do not go further
|
1411
|
+
return;
|
1412
|
+
}
|
1413
|
+
$obj.trigger( {
|
1414
|
+
type: warningEvent,
|
1415
|
+
pointer: $obj,
|
1416
|
+
err: 17
|
1417
|
+
} );
|
1418
|
+
} else {
|
1419
|
+
|
1420
|
+
// Invalid row header
|
1421
|
+
$obj.trigger( {
|
1422
|
+
type: warningEvent,
|
1423
|
+
pointer: $obj,
|
1424
|
+
err: 18
|
1425
|
+
} );
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
|
1429
|
+
if ( row.colgroup.length === 1 ) {
|
1430
|
+
if ( row.colgroup[ 0 ].cell.length > 1 ) {
|
1431
|
+
|
1432
|
+
// this is a row associated to a header row group
|
1433
|
+
if ( !headerRowGroupCompleted ) {
|
1434
|
+
|
1435
|
+
// Good row, stack the row
|
1436
|
+
theadRowStack.push( row );
|
1437
|
+
|
1438
|
+
// We do not go further
|
1439
|
+
return;
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
// Bad row, remove the row or split the table
|
1443
|
+
$obj.trigger( {
|
1444
|
+
type: warningEvent,
|
1445
|
+
pointer: $obj,
|
1446
|
+
err: 18
|
1447
|
+
} );
|
1448
|
+
} else {
|
1449
|
+
if ( currentRowPos !== 1 || row.cell[ 0 ].uid === row.cell[ row.cell.length - 1 ].uid ) {
|
1450
|
+
|
1451
|
+
// Stack the row found for the rowgroup header
|
1452
|
+
rowgroupHeaderRowStack.push( row );
|
1453
|
+
|
1454
|
+
// This will be processed on the first data row
|
1455
|
+
// End of any header row group (thead)
|
1456
|
+
headerRowGroupCompleted = true;
|
1457
|
+
|
1458
|
+
return;
|
1459
|
+
}
|
1460
|
+
$obj.trigger( {
|
1461
|
+
type: warningEvent,
|
1462
|
+
pointer: $obj,
|
1463
|
+
err: 18
|
1464
|
+
} );
|
1465
|
+
}
|
1466
|
+
}
|
1467
|
+
|
1468
|
+
if ( row.colgroup.length > 1 && currentRowPos !== 1 ) {
|
1469
|
+
$obj.trigger( {
|
1470
|
+
type: warningEvent,
|
1471
|
+
pointer: $obj,
|
1472
|
+
err: 21
|
1473
|
+
} );
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
//
|
1477
|
+
// If Valid, process the row
|
1478
|
+
//
|
1479
|
+
} else {
|
1480
|
+
|
1481
|
+
// Digest the data row or summary row
|
1482
|
+
row.type = 2;
|
1483
|
+
|
1484
|
+
// This mark the end of any row group header (thead)
|
1485
|
+
headerRowGroupCompleted = true;
|
1486
|
+
|
1487
|
+
// Check if this row is considerated as a description row for a header
|
1488
|
+
if ( rowgroupHeaderRowStack.length > 0 && row.cell[ 0 ].uid === row.cell[ row.cell.length - 1 ].uid ) {
|
1489
|
+
|
1490
|
+
// Horay this row are a description cell for the preceding heading
|
1491
|
+
|
1492
|
+
row.type = 5;
|
1493
|
+
row.cell[ 0 ].type = 5;
|
1494
|
+
row.cell[ 0 ].row = row;
|
1495
|
+
if ( !row.cell[ 0 ].describe ) {
|
1496
|
+
row.cell[ 0 ].describe = [];
|
1497
|
+
}
|
1498
|
+
rowgroupHeaderRowStack[ rowgroupHeaderRowStack.length - 1 ].cell[ 0 ].descCell = row.cell[ 0 ];
|
1499
|
+
row.cell[ 0 ].describe.push( rowgroupHeaderRowStack[ rowgroupHeaderRowStack.length - 1 ].cell[ 0 ] );
|
1500
|
+
if ( !groupZero.desccell ) {
|
1501
|
+
groupZero.desccell = [];
|
1502
|
+
}
|
1503
|
+
groupZero.desccell.push( row.cell[ 0 ] );
|
1504
|
+
|
1505
|
+
// FYI - We do not push this row in any stack because this row is a description row
|
1506
|
+
|
1507
|
+
// Stop the processing for this row
|
1508
|
+
return;
|
1509
|
+
}
|
1510
|
+
|
1511
|
+
//
|
1512
|
+
// Process any row used to defined the rowgroup label
|
1513
|
+
//
|
1514
|
+
if ( rowgroupHeaderRowStack.length > 0 || !currentRowGroup.type ) {
|
1515
|
+
rowgroupSetup();
|
1516
|
+
}
|
1517
|
+
row.type = currentRowGroup.type;
|
1518
|
+
row.level = currentRowGroup.level;
|
1519
|
+
|
1520
|
+
if ( colgroupFrame[ 0 ] && lastHeadingColPos && colgroupFrame[ 0 ].end !== lastHeadingColPos && colgroupFrame[ 0 ].end === ( lastHeadingColPos + 1 ) ) {
|
1521
|
+
|
1522
|
+
// Adjust if required, the lastHeadingColPos if colgroup are present, that would be the first colgroup
|
1523
|
+
lastHeadingColPos += 1;
|
1524
|
+
}
|
1525
|
+
row.lastHeadingColPos = lastHeadingColPos;
|
1526
|
+
if ( !currentRowGroup.lastHeadingColPos ) {
|
1527
|
+
currentRowGroup.lastHeadingColPos = lastHeadingColPos;
|
1528
|
+
}
|
1529
|
+
if ( !previousDataHeadingColPos ) {
|
1530
|
+
previousDataHeadingColPos = lastHeadingColPos;
|
1531
|
+
}
|
1532
|
+
row.rowgroup = currentRowGroup;
|
1533
|
+
|
1534
|
+
if ( currentRowGroup.lastHeadingColPos !== lastHeadingColPos ) {
|
1535
|
+
if ( ( !lastHeadingSummaryColPos && currentRowGroup.lastHeadingColPos < lastHeadingColPos ) || ( lastHeadingSummaryColPos && lastHeadingSummaryColPos === lastHeadingColPos ) ) {
|
1536
|
+
|
1537
|
+
// This is a virtual summary row group
|
1538
|
+
|
1539
|
+
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
1540
|
+
$.each( spannedRow, function() {
|
1541
|
+
if ( this && this.spanHeight > 0 ) {
|
1542
|
+
|
1543
|
+
// That row are spanned in 2 different row group
|
1544
|
+
$obj.trigger( {
|
1545
|
+
type: warningEvent,
|
1546
|
+
pointer: this,
|
1547
|
+
err: 29
|
1548
|
+
} );
|
1549
|
+
}
|
1550
|
+
} );
|
1551
|
+
|
1552
|
+
// Cleanup of any spanned row
|
1553
|
+
spannedRow = [];
|
1554
|
+
|
1555
|
+
// Remove any rowgroup header found.
|
1556
|
+
rowgroupHeaderRowStack = [];
|
1557
|
+
|
1558
|
+
finalizeRowGroup();
|
1559
|
+
|
1560
|
+
currentRowGroupElement = undefined;
|
1561
|
+
initiateRowGroup();
|
1562
|
+
rowgroupSetup();
|
1563
|
+
|
1564
|
+
// Reset the current row type
|
1565
|
+
row.type = currentRowGroup.type;
|
1566
|
+
|
1567
|
+
} else if ( lastHeadingSummaryColPos && previousDataHeadingColPos === lastHeadingColPos ) {
|
1568
|
+
|
1569
|
+
// This is a virtual data row group
|
1570
|
+
|
1571
|
+
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
1572
|
+
$.each( spannedRow, function() {
|
1573
|
+
if ( this && this.spanHeight > 0 ) {
|
1574
|
+
|
1575
|
+
// That row are spanned in 2 different row group
|
1576
|
+
$obj.trigger( {
|
1577
|
+
type: warningEvent,
|
1578
|
+
pointer: this,
|
1579
|
+
err: 29
|
1580
|
+
} );
|
1581
|
+
}
|
1582
|
+
} );
|
1583
|
+
|
1584
|
+
// Cleanup of any spanned row
|
1585
|
+
spannedRow = [];
|
1586
|
+
|
1587
|
+
// Remove any rowgroup header found.
|
1588
|
+
rowgroupHeaderRowStack = [];
|
1589
|
+
|
1590
|
+
finalizeRowGroup();
|
1591
|
+
|
1592
|
+
currentRowGroupElement = undefined;
|
1593
|
+
initiateRowGroup();
|
1594
|
+
rowgroupSetup( true );
|
1595
|
+
|
1596
|
+
// Reset the current row type
|
1597
|
+
row.type = currentRowGroup.type;
|
1598
|
+
|
1599
|
+
$obj.trigger( {
|
1600
|
+
type: warningEvent,
|
1601
|
+
pointer: row.elem,
|
1602
|
+
err: 34
|
1603
|
+
} );
|
1604
|
+
|
1605
|
+
} else {
|
1606
|
+
$obj.trigger( {
|
1607
|
+
type: warningEvent,
|
1608
|
+
pointer: $obj,
|
1609
|
+
err: 32
|
1610
|
+
} );
|
1611
|
+
}
|
1612
|
+
}
|
1613
|
+
if ( !currentRowGroup.lastHeadingColPos ) {
|
1614
|
+
currentRowGroup.lastHeadingColPos = lastHeadingColPos;
|
1615
|
+
}
|
1616
|
+
|
1617
|
+
if ( currentRowGroup.type === 3 && !lastHeadingSummaryColPos ) {
|
1618
|
+
lastHeadingSummaryColPos = lastHeadingColPos;
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
// Build the initial colgroup structure
|
1622
|
+
// If an cell header exist in that row....
|
1623
|
+
if ( lastHeadingColPos ) {
|
1624
|
+
|
1625
|
+
// Process the heading colgroup associated to this row.
|
1626
|
+
headingRowCell = [];
|
1627
|
+
|
1628
|
+
rowheader = undefined; /* This is the most precise cell header for this row */
|
1629
|
+
colKeyCell = [];
|
1630
|
+
|
1631
|
+
for ( i = 0; i < lastHeadingColPos; i += 1 ) {
|
1632
|
+
|
1633
|
+
// Check for description cell or key cell
|
1634
|
+
if ( row.cell[ i ].elem.nodeName.toLowerCase() === "td" ) {
|
1635
|
+
|
1636
|
+
if ( !row.cell[ i ].type && row.cell[ i - 1 ] && !( row.cell[ i - 1 ].descCell ) && row.cell[ i - 1 ].type === 1 && row.cell[ i - 1 ].height === row.cell[ i ].height ) {
|
1637
|
+
row.cell[ i ].type = 5;
|
1638
|
+
row.cell[ i - 1 ].descCell = row.cell[ i ];
|
1639
|
+
|
1640
|
+
if ( !row.cell[ i ].describe ) {
|
1641
|
+
row.cell[ i ].describe = [];
|
1642
|
+
}
|
1643
|
+
row.cell[ i ].describe.push( row.cell[ i - 1 ] );
|
1644
|
+
|
1645
|
+
if ( !row.desccell ) {
|
1646
|
+
row.desccell = [];
|
1647
|
+
}
|
1648
|
+
row.desccell.push( row.cell[ i ] );
|
1649
|
+
|
1650
|
+
if ( !groupZero.desccell ) {
|
1651
|
+
groupZero.desccell = [];
|
1652
|
+
}
|
1653
|
+
groupZero.desccell.push( row.cell[ i ] );
|
1654
|
+
|
1655
|
+
// Specify the scope of this description cell
|
1656
|
+
row.cell[ i ].scope = "row";
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
// Check if this cell can be an key cell associated to an cell heading
|
1660
|
+
if ( !row.cell[ i ].type ) {
|
1661
|
+
colKeyCell.push( row.cell[ i ] );
|
1662
|
+
}
|
1663
|
+
}
|
1664
|
+
|
1665
|
+
// Set for the most appropriate header that can represent this row
|
1666
|
+
if ( row.cell[ i ].elem.nodeName.toLowerCase() === "th" ) {
|
1667
|
+
|
1668
|
+
// Mark the cell to be an header cell
|
1669
|
+
row.cell[ i ].type = 1;
|
1670
|
+
row.cell[ i ].scope = "row";
|
1671
|
+
if ( rowheader && rowheader.uid !== row.cell[ i ].uid ) {
|
1672
|
+
if ( rowheader.height >= row.cell[ i ].height ) {
|
1673
|
+
if ( rowheader.height === row.cell[ i ].height ) {
|
1674
|
+
$obj.trigger( {
|
1675
|
+
type: warningEvent,
|
1676
|
+
pointer: $obj,
|
1677
|
+
err: 23
|
1678
|
+
} );
|
1679
|
+
}
|
1680
|
+
|
1681
|
+
// The current cell are a child of the previous rowheader
|
1682
|
+
if ( !rowheader.subheader ) {
|
1683
|
+
rowheader.subheader = [];
|
1684
|
+
rowheader.isgroup = true;
|
1685
|
+
}
|
1686
|
+
rowheader.subheader.push( row.cell[ i ] );
|
1687
|
+
|
1688
|
+
// Change the current row header
|
1689
|
+
rowheader = row.cell[ i ];
|
1690
|
+
headingRowCell.push( row.cell[ i ] );
|
1691
|
+
} else {
|
1692
|
+
|
1693
|
+
// This case are either paralel heading of growing header, this are an error.
|
1694
|
+
$obj.trigger( {
|
1695
|
+
type: warningEvent,
|
1696
|
+
pointer: $obj,
|
1697
|
+
err: 24
|
1698
|
+
} );
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
if ( !rowheader ) {
|
1702
|
+
rowheader = row.cell[ i ];
|
1703
|
+
headingRowCell.push( row.cell[ i ] );
|
1704
|
+
}
|
1705
|
+
for ( j = 0; j < colKeyCell.length; j += 1 ) {
|
1706
|
+
if ( !( colKeyCell[ j ].type ) && !( row.cell[ i ].keycell ) && colKeyCell[ j ].height === row.cell[ i ].height ) {
|
1707
|
+
colKeyCell[ j ].type = 4;
|
1708
|
+
row.cell[ i ].keycell = colKeyCell[ j ];
|
1709
|
+
|
1710
|
+
if ( !row.keycell ) {
|
1711
|
+
row.keycell = [];
|
1712
|
+
}
|
1713
|
+
row.keycell.push( colKeyCell[ j ] );
|
1714
|
+
|
1715
|
+
if ( !groupZero.keycell ) {
|
1716
|
+
groupZero.keycell = [];
|
1717
|
+
}
|
1718
|
+
groupZero.keycell.push( colKeyCell[ j ] );
|
1719
|
+
|
1720
|
+
if ( !colKeyCell[ j ].describe ) {
|
1721
|
+
colKeyCell[ j ].describe = [];
|
1722
|
+
}
|
1723
|
+
colKeyCell[ j ].describe.push( row.cell[ i ] );
|
1724
|
+
}
|
1725
|
+
}
|
1726
|
+
}
|
1727
|
+
}
|
1728
|
+
|
1729
|
+
// All the cell that have no "type" in the colKeyCell collection are problematic cells
|
1730
|
+
$.each( colKeyCell, function() {
|
1731
|
+
if ( !( this.type ) ) {
|
1732
|
+
$obj.trigger( {
|
1733
|
+
type: warningEvent,
|
1734
|
+
pointer: $obj,
|
1735
|
+
err: 25
|
1736
|
+
} );
|
1737
|
+
if ( !row.errorcell ) {
|
1738
|
+
row.errorcell = [];
|
1739
|
+
}
|
1740
|
+
row.errorcell.push( this );
|
1741
|
+
}
|
1742
|
+
} );
|
1743
|
+
row.header = headingRowCell;
|
1744
|
+
} else {
|
1745
|
+
|
1746
|
+
// There are only at least one colgroup,
|
1747
|
+
// Any colgroup tag defined but be equal or greater than 0.
|
1748
|
+
// if colgroup tag defined, they are all data colgroup.
|
1749
|
+
lastHeadingColPos = 0;
|
1750
|
+
|
1751
|
+
if ( colgroupFrame.length === 0 ) {
|
1752
|
+
processColgroup( undefined, tableCellWidth );
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
//
|
1757
|
+
// Process the table row heading and colgroup if required
|
1758
|
+
//
|
1759
|
+
processRowgroupHeader( lastHeadingColPos );
|
1760
|
+
|
1761
|
+
row.headerset = ( currentRowGroup.headerlevel || [] );
|
1762
|
+
|
1763
|
+
if ( lastHeadingColPos !== 0 ) {
|
1764
|
+
lastHeadingColPos = colgroupFrame[ 0 ].end; /* colgroupFrame must be defined here */
|
1765
|
+
}
|
1766
|
+
|
1767
|
+
//
|
1768
|
+
// Associate the data cell type with the colgroup if any,
|
1769
|
+
// Process the data cell. There are a need to have at least one data cell per data row.
|
1770
|
+
if ( !row.datacell ) {
|
1771
|
+
row.datacell = [];
|
1772
|
+
}
|
1773
|
+
for ( i = lastHeadingColPos; i < row.cell.length; i += 1 ) {
|
1774
|
+
isDataColgroupType = true;
|
1775
|
+
|
1776
|
+
for ( j = ( lastHeadingColPos === 0 ? 0 : 1 ); j < colgroupFrame.length; j += 1 ) {
|
1777
|
+
|
1778
|
+
// If colgroup, the first are always header colgroup
|
1779
|
+
if ( colgroupFrame[ j ].start <= row.cell[ i ].colpos && row.cell[ i ].colpos <= colgroupFrame[ j ].end ) {
|
1780
|
+
if ( row.type === 3 || colgroupFrame[ j ].type === 3 ) {
|
1781
|
+
row.cell[ i ].type = 3; /* Summary Cell */
|
1782
|
+
} else {
|
1783
|
+
row.cell[ i ].type = 2;
|
1784
|
+
}
|
1785
|
+
|
1786
|
+
// Test if this cell is a layout cell
|
1787
|
+
if ( row.type === 3 && colgroupFrame[ j ].type === 3 && ( $( row.cell[ i ].elem ).text().length === 0 ) ) {
|
1788
|
+
row.cell[ i ].type = 6;
|
1789
|
+
if ( !groupZero.layoutCell ) {
|
1790
|
+
groupZero.layoutCell = [];
|
1791
|
+
}
|
1792
|
+
groupZero.layoutCell.push( row.cell[ i ] );
|
1793
|
+
}
|
1794
|
+
|
1795
|
+
row.cell[ i ].collevel = colgroupFrame[ j ].level;
|
1796
|
+
row.datacell.push( row.cell[ i ] );
|
1797
|
+
}
|
1798
|
+
isDataColgroupType = !isDataColgroupType;
|
1799
|
+
}
|
1800
|
+
|
1801
|
+
if ( colgroupFrame.length === 0 ) {
|
1802
|
+
|
1803
|
+
// There are no colgroup definition, this cell are set to be a datacell
|
1804
|
+
row.cell[ i ].type = 2;
|
1805
|
+
row.datacell.push( row.cell[ i ] );
|
1806
|
+
}
|
1807
|
+
|
1808
|
+
// Add row header when the cell is span into more than one row
|
1809
|
+
if ( row.cell[ i ].rowpos < currentRowPos ) {
|
1810
|
+
if ( !row.cell[ i ].addrowheaders ) {
|
1811
|
+
|
1812
|
+
// addrowheaders for additional row headers
|
1813
|
+
row.cell[ i ].addrowheaders = [];
|
1814
|
+
}
|
1815
|
+
if ( row.header ) {
|
1816
|
+
for ( j = 0; j < row.header.length; j += 1 ) {
|
1817
|
+
if ( ( row.header[ j ].rowpos === currentRowPos && row.cell[ i ].addrowheaders.length === 0 ) || ( row.header[ j ].rowpos === currentRowPos && row.cell[ i ].addrowheaders[ row.cell[ i ].addrowheaders.length - 1 ].uid !== row.header[ j ].uid ) ) {
|
1818
|
+
|
1819
|
+
// Add the current header
|
1820
|
+
row.cell[ i ].addrowheaders.push( row.header[ j ] );
|
1821
|
+
}
|
1822
|
+
}
|
1823
|
+
}
|
1824
|
+
}
|
1825
|
+
}
|
1826
|
+
|
1827
|
+
// Add the cell in his appropriate column
|
1828
|
+
if ( !groupZero.col ) {
|
1829
|
+
groupZero.col = [];
|
1830
|
+
}
|
1831
|
+
|
1832
|
+
for ( i = 0; i < groupZero.col.length; i += 1 ) {
|
1833
|
+
for ( j = ( groupZero.col[ i ].start - 1 ); j < groupZero.col[ i ].end; j += 1 ) {
|
1834
|
+
if ( !groupZero.col[ i ].cell ) {
|
1835
|
+
groupZero.col[ i ].cell = [];
|
1836
|
+
}
|
1837
|
+
|
1838
|
+
// Be sure to do not include twice the same cell for a column spanned in 2 or more column
|
1839
|
+
if ( !( j > ( groupZero.col[ i ].start - 1 ) && groupZero.col[ i ].cell[ groupZero.col[ i ].cell.length - 1 ].uid === row.cell[ j ].uid ) ) {
|
1840
|
+
if ( row.cell[ j ] ) {
|
1841
|
+
groupZero.col[ i ].cell.push( row.cell[ j ] );
|
1842
|
+
if ( !row.cell[ j ].col ) {
|
1843
|
+
row.cell[ j ].col = groupZero.col[ i ];
|
1844
|
+
}
|
1845
|
+
} else {
|
1846
|
+
$obj.trigger( {
|
1847
|
+
type: warningEvent,
|
1848
|
+
pointer: $obj,
|
1849
|
+
err: 35
|
1850
|
+
} );
|
1851
|
+
}
|
1852
|
+
}
|
1853
|
+
}
|
1854
|
+
}
|
1855
|
+
|
1856
|
+
// Associate the row with the cell and Colgroup/Col association
|
1857
|
+
for ( i = 0; i < row.cell.length; i += 1 ) {
|
1858
|
+
if ( !row.cell[ i ].row ) {
|
1859
|
+
row.cell[ i ].row = row;
|
1860
|
+
}
|
1861
|
+
row.cell[ i ].rowlevel = currentRowGroup.level;
|
1862
|
+
row.cell[ i ].rowlevelheader = currentRowGroup.headerlevel;
|
1863
|
+
row.cell[ i ].rowgroup = currentRowGroup;
|
1864
|
+
|
1865
|
+
if ( i > 0 && row.cell[ i - 1 ].uid === row.cell[ i ].uid && row.cell[ i ].type !== 1 && row.cell[ i ].type !== 5 && row.cell[ i ].rowpos === currentRowPos && row.cell[ i ].colpos <= i ) {
|
1866
|
+
if ( !row.cell[ i ].addcolheaders ) {
|
1867
|
+
|
1868
|
+
// addcolheaders for additional col headers
|
1869
|
+
row.cell[ i ].addcolheaders = [];
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
// Add the column header if required
|
1873
|
+
if ( groupZero.col[ i ] && groupZero.col[ i ].header ) {
|
1874
|
+
for ( j = 0; j < groupZero.col[ i ].header.length; j += 1 ) {
|
1875
|
+
if ( groupZero.col[ i ].header[ j ].colpos === ( i + 1 ) ) {
|
1876
|
+
|
1877
|
+
// Add the current header
|
1878
|
+
row.cell[ i ].addcolheaders.push( groupZero.col[ i ] .header[ j ] );
|
1879
|
+
}
|
1880
|
+
}
|
1881
|
+
}
|
1882
|
+
}
|
1883
|
+
}
|
1884
|
+
}
|
1885
|
+
|
1886
|
+
// Add the row to the groupZero
|
1887
|
+
if ( !groupZero.row ) {
|
1888
|
+
groupZero.row = [];
|
1889
|
+
}
|
1890
|
+
groupZero.row.push( row );
|
1891
|
+
currentRowGroup.row.push( row );
|
1892
|
+
|
1893
|
+
delete row.colgroup;
|
1894
|
+
} /* End processRow function */
|
1895
|
+
|
1896
|
+
// Add headers information to the table parsed data structure
|
1897
|
+
// Similar sample of code as the HTML Table validator
|
1898
|
+
function addHeaders( tblparser ) {
|
1899
|
+
var headStackLength = tblparser.theadRowStack.length,
|
1900
|
+
addColHeadersLength, addRowHeadersLength,
|
1901
|
+
cellHeaderLength, cellLength, childLength, coldataheader,
|
1902
|
+
colheaders, colheadersgroup, currCell, currCol, currRow,
|
1903
|
+
currrowheader, headerLength, headerLevelLength, i, j, k, m, ongoingRowHeader, ongoingRowHeaderLength,
|
1904
|
+
rowheaders,
|
1905
|
+
rowheadersgroup, rowLength;
|
1906
|
+
|
1907
|
+
// Set ID and Header for the table head
|
1908
|
+
for ( i = 0; i < headStackLength; i += 1 ) {
|
1909
|
+
currRow = tblparser.theadRowStack[ i ];
|
1910
|
+
|
1911
|
+
for ( j = 0, cellLength = currRow.cell.length; j < cellLength; j += 1 ) {
|
1912
|
+
currCell = currRow.cell[ j ];
|
1913
|
+
|
1914
|
+
if ( ( currCell.type === 1 || currCell.type === 7 ) && (
|
1915
|
+
!( j > 0 && currCell.uid === currRow.cell[ j - 1 ].uid ) &&
|
1916
|
+
!( i > 0 && currCell.uid === tblparser.theadRowStack[ i - 1 ].cell[ j ].uid )
|
1917
|
+
) ) {
|
1918
|
+
|
1919
|
+
// Imediate header
|
1920
|
+
currCell.header = currCell.header || [];
|
1921
|
+
|
1922
|
+
// all the headers
|
1923
|
+
currCell.headers = currCell.headers || [];
|
1924
|
+
|
1925
|
+
// Imediate sub cell
|
1926
|
+
currCell.child = currCell.child || [];
|
1927
|
+
|
1928
|
+
// All the sub cell
|
1929
|
+
currCell.childs = currCell.childs || [];
|
1930
|
+
|
1931
|
+
// Set the header of the current cell if required
|
1932
|
+
if ( i > 0 ) {
|
1933
|
+
|
1934
|
+
// All the header cells
|
1935
|
+
for ( k = 0, cellHeaderLength = tblparser.theadRowStack[ i - 1 ].cell[ j ].header.length; k < cellHeaderLength; k += 1 ) {
|
1936
|
+
currCell.headers.push( tblparser.theadRowStack[ i - 1 ].cell[ j ].header[ k ] );
|
1937
|
+
tblparser.theadRowStack[ i - 1 ].cell[ j ].header[ k ].childs.push( currCell );
|
1938
|
+
}
|
1939
|
+
|
1940
|
+
// Imediate header cell
|
1941
|
+
currCell.headers.push( tblparser.theadRowStack[ i - 1 ].cell[ j ] );
|
1942
|
+
currCell.header.push( tblparser.theadRowStack[ i - 1 ].cell[ j ] );
|
1943
|
+
tblparser.theadRowStack[ i - 1 ].cell[ j ].child.push( currCell );
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
// Set the header on his descriptive cell if any
|
1947
|
+
if ( currCell.descCell ) {
|
1948
|
+
currCell.descCell.header = currCell;
|
1949
|
+
currCell.descCell.headers = currCell;
|
1950
|
+
}
|
1951
|
+
}
|
1952
|
+
|
1953
|
+
}
|
1954
|
+
|
1955
|
+
}
|
1956
|
+
|
1957
|
+
// Set Id/headers for header cell and data cell in the table.
|
1958
|
+
for ( i = 0, rowLength = tblparser.row.length; i < rowLength; i += 1 ) {
|
1959
|
+
currRow = tblparser.row[ i ];
|
1960
|
+
rowheadersgroup = [];
|
1961
|
+
rowheaders = [];
|
1962
|
+
currrowheader = [];
|
1963
|
+
ongoingRowHeader = [];
|
1964
|
+
coldataheader = [];
|
1965
|
+
|
1966
|
+
// Get or Generate a unique ID for each header in this row
|
1967
|
+
if ( currRow.headerset && !currRow.idsheaderset ) {
|
1968
|
+
for ( j = 0; j < currRow.headerset.length; j += 1 ) {
|
1969
|
+
rowheadersgroup = rowheadersgroup.concat( currRow.headerset[ j ] );
|
1970
|
+
}
|
1971
|
+
currRow.idsheaderset = rowheadersgroup;
|
1972
|
+
}
|
1973
|
+
|
1974
|
+
if ( currRow.header ) {
|
1975
|
+
for ( j = 0; j < currRow.header.length; j += 1 ) {
|
1976
|
+
rowheaders = rowheaders.concat( currRow.header[ j ] );
|
1977
|
+
}
|
1978
|
+
}
|
1979
|
+
rowheaders = currRow.idsheaderset.concat( rowheaders );
|
1980
|
+
for ( j = 0; j < currRow.cell.length; j += 1 ) {
|
1981
|
+
|
1982
|
+
if ( j === 0 || ( j > 0 && currRow.cell[ j ].uid !== currRow.cell[ ( j - 1 ) ].uid ) ) {
|
1983
|
+
currCell = currRow.cell[ j ];
|
1984
|
+
coldataheader = [];
|
1985
|
+
|
1986
|
+
// Imediate header
|
1987
|
+
currCell.header = currCell.header || [];
|
1988
|
+
|
1989
|
+
// all the headers
|
1990
|
+
currCell.headers = currCell.headers || [];
|
1991
|
+
|
1992
|
+
if ( currCell.col && !currCell.col.dataheader ) {
|
1993
|
+
currCol = currCell.col;
|
1994
|
+
colheaders = [];
|
1995
|
+
colheadersgroup = [];
|
1996
|
+
if ( currCol.headerLevel ) {
|
1997
|
+
for ( m = 0, headerLevelLength = currCol.headerLevel.length; m < headerLevelLength; m += 1 ) {
|
1998
|
+
colheadersgroup = colheadersgroup.concat( currCol.headerLevel[ m ] );
|
1999
|
+
}
|
2000
|
+
}
|
2001
|
+
if ( currCol.header ) {
|
2002
|
+
for ( m = 0, headerLength = currCol.header.length; m < headerLength; m += 1 ) {
|
2003
|
+
colheaders = colheaders.concat( currCol.header[ m ] );
|
2004
|
+
}
|
2005
|
+
}
|
2006
|
+
|
2007
|
+
if ( !currCol.dataheader ) {
|
2008
|
+
currCol.dataheader = [];
|
2009
|
+
}
|
2010
|
+
|
2011
|
+
currCol.dataheader = currCol.dataheader.concat( colheadersgroup );
|
2012
|
+
currCol.dataheader = currCol.dataheader.concat( colheaders );
|
2013
|
+
}
|
2014
|
+
|
2015
|
+
if ( currCell.col && currCell.col.dataheader ) {
|
2016
|
+
coldataheader = currCell.col.dataheader;
|
2017
|
+
}
|
2018
|
+
|
2019
|
+
if ( currCell.type === 1 ) {
|
2020
|
+
|
2021
|
+
// Imediate sub cell
|
2022
|
+
currCell.child = currCell.child || [];
|
2023
|
+
|
2024
|
+
// All the sub cell
|
2025
|
+
currCell.childs = currCell.childs || [];
|
2026
|
+
|
2027
|
+
for ( m = 0, ongoingRowHeaderLength = ongoingRowHeader.length; m < ongoingRowHeaderLength; m += 1 ) {
|
2028
|
+
|
2029
|
+
if ( currCell.colpos === ( ongoingRowHeader[ m ].colpos + ongoingRowHeader[ m ].width ) ) {
|
2030
|
+
childLength = ongoingRowHeader[ m ].child.length;
|
2031
|
+
if ( childLength === 0 || ( childLength > 0 && ongoingRowHeader[ m ].child[ childLength - 1 ].uid !== currCell.uid ) ) {
|
2032
|
+
ongoingRowHeader[ m ].child.push( currCell );
|
2033
|
+
}
|
2034
|
+
}
|
2035
|
+
ongoingRowHeader[ m ].childs.push( currCell );
|
2036
|
+
}
|
2037
|
+
|
2038
|
+
for ( m = 0; m < currRow.idsheaderset.length; m += 1 ) {
|
2039
|
+
|
2040
|
+
// All the sub cell
|
2041
|
+
if ( !currRow.idsheaderset[ m ].childs ) {
|
2042
|
+
currRow.idsheaderset[ m ].childs = [];
|
2043
|
+
}
|
2044
|
+
currRow.idsheaderset[ m ].childs.push( currCell );
|
2045
|
+
}
|
2046
|
+
|
2047
|
+
currCell.header = currCell.header.concat( ongoingRowHeader );
|
2048
|
+
|
2049
|
+
currCell.headers = currCell.headers.concat( coldataheader )
|
2050
|
+
.concat( currRow.idsheaderset )
|
2051
|
+
.concat( ongoingRowHeader );
|
2052
|
+
|
2053
|
+
ongoingRowHeader = ongoingRowHeader.concat( currCell );
|
2054
|
+
}
|
2055
|
+
|
2056
|
+
if ( currCell.type === 2 || currCell.type === 3 ) {
|
2057
|
+
|
2058
|
+
// Get Current Column Headers
|
2059
|
+
currrowheader = rowheaders;
|
2060
|
+
|
2061
|
+
if ( currCell.addcolheaders ) {
|
2062
|
+
for ( m = 0, addColHeadersLength = currCell.addcolheaders.length; m < addColHeadersLength; m += 1 ) {
|
2063
|
+
coldataheader = coldataheader.concat( currCell.addcolheaders[ m ] );
|
2064
|
+
}
|
2065
|
+
}
|
2066
|
+
|
2067
|
+
if ( currCell.addrowheaders ) {
|
2068
|
+
for ( m = 0, addRowHeadersLength = currCell.addrowheaders.length; m < addRowHeadersLength; m += 1 ) {
|
2069
|
+
currrowheader = currrowheader.concat( currCell.addrowheaders[ m ] );
|
2070
|
+
}
|
2071
|
+
}
|
2072
|
+
|
2073
|
+
currCell.headers = currCell.headers.concat( coldataheader )
|
2074
|
+
.concat( currrowheader );
|
2075
|
+
|
2076
|
+
currCell.header = currCell.headers;
|
2077
|
+
}
|
2078
|
+
}
|
2079
|
+
}
|
2080
|
+
}
|
2081
|
+
} /* END addHeaders function*/
|
2082
|
+
|
2083
|
+
//
|
2084
|
+
// Main Entry For The Table Parsing
|
2085
|
+
//
|
2086
|
+
if ( hasTfoot ) {
|
2087
|
+
|
2088
|
+
// If there is a tfoot element, be sure to add it at the end of all the tbody. FYI - HTML 5 spec allow now tfoot to be at the end
|
2089
|
+
$( "tfoot", $obj ).appendTo( $( "tbody:last", $obj ).parent() );
|
2090
|
+
}
|
2091
|
+
$obj.children().each( function() {
|
2092
|
+
var $this = $( this ),
|
2093
|
+
nodeName = this.nodeName.toLowerCase();
|
2094
|
+
|
2095
|
+
if ( nodeName === "caption" ) {
|
2096
|
+
processCaption( this );
|
2097
|
+
} else if ( nodeName === "colgroup" ) {
|
2098
|
+
processColgroup( this );
|
2099
|
+
} else if ( nodeName === "thead" ) {
|
2100
|
+
currentRowGroupElement = this;
|
2101
|
+
|
2102
|
+
// The table should not have any row at this point
|
2103
|
+
if ( theadRowStack.length !== 0 || ( groupZero.row && groupZero.row.length > 0 ) ) {
|
2104
|
+
$obj.trigger( {
|
2105
|
+
type: warningEvent,
|
2106
|
+
pointer: this,
|
2107
|
+
err: 26
|
2108
|
+
} );
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
$( this ).data( "tblparser", groupZero );
|
2112
|
+
stackRowHeader = true;
|
2113
|
+
|
2114
|
+
// This is the rowgroup header, Colgroup type can not be defined here
|
2115
|
+
$( this ).children().each( function() {
|
2116
|
+
if ( this.nodeName.toLowerCase() !== "tr" ) {
|
2117
|
+
|
2118
|
+
// ERROR
|
2119
|
+
$obj.trigger( {
|
2120
|
+
type: warningEvent,
|
2121
|
+
pointer: this,
|
2122
|
+
err: 27
|
2123
|
+
} );
|
2124
|
+
}
|
2125
|
+
processRow( this );
|
2126
|
+
} );
|
2127
|
+
|
2128
|
+
stackRowHeader = false;
|
2129
|
+
|
2130
|
+
// Here it"s not possible to Diggest the thead and the colgroup because we need the first data row to be half processed before
|
2131
|
+
} else if ( nodeName === "tbody" || nodeName === "tfoot" ) {
|
2132
|
+
|
2133
|
+
if ( nodeName === "tfoot" ) {
|
2134
|
+
tfootOnProcess = true;
|
2135
|
+
}
|
2136
|
+
|
2137
|
+
// Currently there are no specific support for tfoot element, the tfoot is understood as a normal tbody
|
2138
|
+
|
2139
|
+
currentRowGroupElement = this;
|
2140
|
+
initiateRowGroup();
|
2141
|
+
|
2142
|
+
$this.data().tblparser = currentRowGroup;
|
2143
|
+
|
2144
|
+
/*
|
2145
|
+
*
|
2146
|
+
*
|
2147
|
+
*
|
2148
|
+
* First tbody = data
|
2149
|
+
* All tbody with header === data
|
2150
|
+
* Subsequent tbody without header === summary
|
2151
|
+
*
|
2152
|
+
*/
|
2153
|
+
|
2154
|
+
// New row group
|
2155
|
+
$this.children().each( function() {
|
2156
|
+
if ( this.nodeName.toLowerCase() !== "tr" ) {
|
2157
|
+
|
2158
|
+
// ERROR
|
2159
|
+
$obj.trigger( {
|
2160
|
+
type: warningEvent,
|
2161
|
+
pointer: this,
|
2162
|
+
err: 27
|
2163
|
+
} );
|
2164
|
+
return;
|
2165
|
+
}
|
2166
|
+
processRow( this );
|
2167
|
+
} );
|
2168
|
+
|
2169
|
+
finalizeRowGroup();
|
2170
|
+
|
2171
|
+
// Check for residual rowspan, there can not have cell that overflow on two or more rowgroup
|
2172
|
+
$.each( spannedRow, function() {
|
2173
|
+
if ( this && this.spanHeigh && this.spanHeight > 0 ) {
|
2174
|
+
|
2175
|
+
// That row are spanned in 2 different row group
|
2176
|
+
$obj.trigger( {
|
2177
|
+
type: warningEvent,
|
2178
|
+
pointer: this,
|
2179
|
+
err: 29
|
2180
|
+
} );
|
2181
|
+
}
|
2182
|
+
} );
|
2183
|
+
|
2184
|
+
spannedRow = []; /* Cleanup of any spanned row */
|
2185
|
+
rowgroupHeaderRowStack = []; /* Remove any rowgroup header found. */
|
2186
|
+
|
2187
|
+
} else if ( nodeName === "tr" ) {
|
2188
|
+
|
2189
|
+
// This are suppose to be a simple table
|
2190
|
+
processRow( this );
|
2191
|
+
} else {
|
2192
|
+
|
2193
|
+
// There is a DOM Structure error
|
2194
|
+
$obj.trigger( {
|
2195
|
+
type: errorEvent,
|
2196
|
+
pointer: this,
|
2197
|
+
err: 30
|
2198
|
+
} );
|
2199
|
+
}
|
2200
|
+
} );
|
2201
|
+
|
2202
|
+
groupZero.theadRowStack = theadRowStack;
|
2203
|
+
|
2204
|
+
delete groupZero.colgroupFrame;
|
2205
|
+
groupZero.colgrouplevel = groupZero.colgrp;
|
2206
|
+
delete groupZero.colgrp;
|
2207
|
+
|
2208
|
+
addHeaders( groupZero );
|
2209
|
+
|
2210
|
+
$obj.trigger( "parsecomplete" + selector );
|
2211
|
+
};
|
2212
|
+
|
2213
|
+
// Bind the init event of the plugin on passive table parsing request
|
2214
|
+
$document.on( "passiveparse" + selector, init );
|
2215
|
+
|
2216
|
+
} )( jQuery, window, document, wb );
|