From f0ae0138b74a3190f15161cc5eed1e0eb53be836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bahad=C4=B1r?= <45143524+bahadirsofuoglu@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:24:39 +0300 Subject: [PATCH] Rating component features completed (#2893) * Rating component features completed * Change asset * Cancel icon templating completed * Templating changes Docs completed * Accessibility issues solved * Rating clickoutside issue solved * Icon src name changed * About cancel focus problem * Keyboard event bug fixes * Template refactor Co-authored-by: Onur Senture --- api-generator/components/rating.js | 18 +++ public/demo/images/rating/cancel.png | Bin 0 -> 1850 bytes public/demo/images/rating/custom-asset-2.png | Bin 0 -> 4157 bytes public/demo/images/rating/custom-asset.png | Bin 0 -> 1922 bytes src/components/rating/Rating.d.ts | 15 +++ src/components/rating/Rating.vue | 114 +++++++++++++++++-- src/views/rating/RatingDemo.vue | 20 +++- src/views/rating/RatingDoc.vue | 81 +++++++++++++ 8 files changed, 235 insertions(+), 13 deletions(-) create mode 100644 public/demo/images/rating/cancel.png create mode 100644 public/demo/images/rating/custom-asset-2.png create mode 100644 public/demo/images/rating/custom-asset.png diff --git a/api-generator/components/rating.js b/api-generator/components/rating.js index 794bc7e8f8..131abdf1d7 100644 --- a/api-generator/components/rating.js +++ b/api-generator/components/rating.js @@ -28,6 +28,24 @@ const RatingProps = [ type: 'boolean', default: 'true', description: 'When specified a cancel icon is displayed to allow clearing the value.' + }, + { + name: 'onIcon', + type: 'string', + default: 'pi pi-star', + description: 'Can be used to add different icon.' + }, + { + name: 'offIcon', + type: 'string', + default: 'pi pi-star-fill', + description: 'Can be used to add different icon.' + }, + { + name: 'cancelIcon', + type: 'string', + default: 'pi pi-ban', + description: 'Can be used to add different cancel icon.' } ]; diff --git a/public/demo/images/rating/cancel.png b/public/demo/images/rating/cancel.png new file mode 100644 index 0000000000000000000000000000000000000000..8482598af6f1d00188f7df68de6fee784d0e0027 GIT binary patch literal 1850 zcmV-A2gUe_P)D9DX*t-SxI>2Z&5W4U$bd=sH7e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(;7FMkRg*foi_$`(N14s5&th%wT7nM`!+bc%4_eVyNy zluW#xK3}xR^{ZZgF*HVn29oU)I|b}*1SUP;QYOv=A)c7Z$AO(C!Jt3 z@Wk(cU(}EXlSYItpg9|#KHNawVPO3QAfPo7O^S~+0`>L4EmKag8F=a};1#Y{MCb&X zv$+^?1G*!?Yv%xNfPCos8wl?L-r5T2rk!9j@XVipp9A7uz#jJueEQf0=-PnSuK;27 z4(|XOUde`dHC_aAKLFfaz;_Lr88+Kd2jsT{?XAG+r-8XyBYpwM-2yz;2&~@>%;Px# literal 0 HcmV?d00001 diff --git a/public/demo/images/rating/custom-asset-2.png b/public/demo/images/rating/custom-asset-2.png new file mode 100644 index 0000000000000000000000000000000000000000..ca38b0d290264d6bb588d814d9b91bd57eb9c82b GIT binary patch literal 4157 zcmV-D5W???P)Jyb4M&$vSUhY$6+jYnRz$MU1nxxW@ct)X2vo%O*u~EFq(xU&CG@0Yfo#{ zDYrj8=e+066@KsiK*0ZJEV#n*{~O7jz{CTWirR6#Yf8sg?;(ub7`onY(hEw`)hV!O zBU`O7QBDx-^O}15wtC@wnVa4L815kA{4Wi1d+Dqc))cd?CuEY%$EJ(56Gf?+a&ijN zK+*$O0)W;KMBsy|3v?|Nh_HCYKQ45BcckI|8rXij4Seeb%ek$bIJjihvi$hlie1&G zCVMJbdVxX-@|z&D4ic+D_5nFSfNg>~3c()mcR=kLm^uPJFkNUJ-k<;ZRC4H}x5tRM z;!F47Rx@5sbZ4q>@9L?(+3TsL=>dB03Z*TOxd%9#fD+&W4j`Dv0va$t9qb6SE`sU5 z!O_!ar3uR!RXIQZsj+m|2Y|+{HgM$|H*#xGY4^BQoqNBYUs}66eZaDlq3@ZHeF)G8 zC@^)vv>9l}#3n2_Ss(?Jp>-CF{RsB{8){J9SG;s$toS0}(pzO<^j*W;64Tl4$DWY6 z;undbz+eRfrC@11JZ7v zT>A{*C%0Te@4bZ#Sn=%R`mX*S%YdPku;%rUx#xV~rU}9W>jG{ZyaW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yHNp+;j7Cf>k zL1rMw>F2b#_<{+B2S6)J%Ll&>O&=l+!UZAcSJxF-0oGWohA0H1KxmK>G8stcAeDwx z3Yty9L_NV%p3uj@l8D+^KoDB|T1a!IMg5RvPx_vlfvagl{Nh#jVKFOuF8`R`*?4ou zT8~U2K`QN1%u8ffj$i+^%I<4t7+U5b1Rw+g05f;m=0DPH6G+5z1di(>oLM2TSgZvh z#M~(#9*2i*>F1<%g2oY_W@KnJ6wPWx?Ldg{roIfkf<=h4Uy)@o8(twYSAJAnTt>{7D{E`U@sgRDM7ypktr&|hqPFh*Uj)ss-vE|WyY+h+;9j@UA&}wN~^@ym_V!Gn7 zVwruK`WP7}%uSL})y-CbjH%*SelbU&dmljh}S&gif~0!%2E`CZvRH$|2XCMLQ{u%vi>!HPe-Ft}#Pp5kS&&$Yv#- zB}spmq`PRrZ&I6T(u_bU=7QI=@@GOO#wFR#{Pib)*H2F^1b-V1T>r$q-^ib|`(pi# ztP`Bl*(;D~4|ndv&cP9oPC8_B9&RFml@j4N7$FeWBDn6SqCy1`_4>RyV=OA1Rb$YE#vU8^?KTjjxIsGie>=T#VxKszJYgQ|xb}D%*+kMc zB=VMo3&LR@V+oa@6$--0L0J)@#nriP_qY8^^>2VHh#A<@asb1vMA%Vo4}uYh%`kqk zE6a`4`Y5mOp)=0L%6>T%T3Zy#WWb^wrQM- literal 0 HcmV?d00001 diff --git a/public/demo/images/rating/custom-asset.png b/public/demo/images/rating/custom-asset.png new file mode 100644 index 0000000000000000000000000000000000000000..7047c28f4e4ad63775ab9f9c3ed242d1834faea6 GIT binary patch literal 1922 zcmV-|2YvX7P)0@SQW@e_&cG{+xG>Lt#KFf-t zc0jbxTeObi+uXLf=4+Q*IwFq%G__xHRp_% zRhL$RT(4BDDy((C`n<_MIJYFc5IgyHee$WTC+-@bGGo@bOt784u2sw0HV1G2)5a+q z>?EABljimN|7q79Gj`jpDN%?b2q1z)qR_EuUf~-bT6lmD*+KX_+Zp`AzUNY zU?2(zj51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6_pA7}v3vVZo?6DAOAth!ee-AkIlZ-|p{6!`7X%54p<*D{FB`OM;}eJO@4eh} zG#+6cqcp?UiLYp`KfV39$=Y-&NvjEucw+- zqhi_jNPqCj=1XQ@>|^l5iGrPkFE|$=e3HnAvv}3?cQvm$eK?uTCkk07YfpZ?{psZ0 z@zZ)-9d0F_GvzDJM-fEl=K?Fj@l@`Dd|%jSG-y6761gz{54y~MP?5!NVE_OC07*qo IM6N<$g7hHT?*IS* literal 0 HcmV?d00001 diff --git a/src/components/rating/Rating.d.ts b/src/components/rating/Rating.d.ts index 42b755aa42..a0ecad5e86 100755 --- a/src/components/rating/Rating.d.ts +++ b/src/components/rating/Rating.d.ts @@ -38,6 +38,21 @@ export interface RatingProps { * Default value is true. */ cancel?: boolean | undefined; + /** + * Can be used to add different icon. + * Default value is pi pi-star. + */ + onIcon?: string | undefined; + /** + * Can be used to add different icon. + * Default value is pi pi-star-fill. + */ + offIcon?: string | undefined; + /** + * Can be used to add different cancel icon. + * Default value is pi pi-ban. + */ + cancelIcon?: string | undefined; } export interface RatingSlots { diff --git a/src/components/rating/Rating.vue b/src/components/rating/Rating.vue index 9186d46b61..3f975051f5 100755 --- a/src/components/rating/Rating.vue +++ b/src/components/rating/Rating.vue @@ -1,12 +1,28 @@