This commit is contained in:
2024-08-29 02:57:08 +03:00
parent 12748387d5
commit f9512affa4
3 changed files with 107 additions and 53 deletions
+34 -22
View File
@@ -1,8 +1,12 @@
<?php <?php
/** /**
* @var \Wt\Core\Templater\Shell $this * @var Shell $this
* @var \Wt\Core\Form\Field\DefaultField $field * @var DefaultField $field
* @var array $arParams
*/ */
use Wt\Core\Form\Field\DefaultField;
use Wt\Core\Templater\Shell;
use Wt\Core\Templater\Tools as TemplaterTools; use Wt\Core\Templater\Tools as TemplaterTools;
use Wt\Core\Tools; use Wt\Core\Tools;
@@ -28,54 +32,62 @@ if($isDatepicker) {
?> ?>
<label class="kit-field kit-field--text<?=($field->isHidden()?' hidden':'')?> <?=$arParams['WRAP_CLASS']?>"<? <label class="kit-field kit-field--text<?=($field->isHidden()?' hidden':'')?> <?=$arParams['WRAP_CLASS']?>"<?php
if(strlen($field->getId())){?> for="<?=$field->getId()?>"<?}?>> if(strlen($field->getId())){?> for="<?=$field->getId()?>"<?php
<input<? }?>>
if($isReadonly){?> readonly<?} <input<?php
if($isRequired){?> required<?} if($isReadonly){?> readonly<?php
if($isChecked){?> checked<?} }
if($isDisabled){?> disabled<?} if($isRequired){?> required<?php
}
if($isChecked){?> checked<?php
}
if($isDisabled){?> disabled<?php
}
if(strlen($field->getId())){?> id="<?=$field->getId()?>"<?} if(strlen($field->getId())){?> id="<?=$field->getId()?>"<?php
}
?> ?>
data-dirty="<?=$field->isDirty()?'true':'false'?>" data-dirty="<?=$field->isDirty()?'true':'false'?>"
type="<?=$field->getType()?>" type="<?=$field->getType()?>"
name="<?=$field->getName()?>" name="<?=$field->getName()?>"
class="kit-field__input <?=$arParams['CLASS']?> <?=$arParams['ADD_CLASS']?><? class="kit-field__input <?=$arParams['CLASS']?> <?=$arParams['ADD_CLASS']?><?php
if(strlen($arParams['MESSAGE'])) { if(strlen($arParams['MESSAGE'])) {
if(Tools::isSuccess($arParams['MESSAGE_TYPE'])){ if(Tools::isSuccess($arParams['MESSAGE_TYPE'])){
?> kit-field--success<? ?> kit-field--success<?php
} else { } else {
?> kit-field--error<? ?> kit-field--error<?php
} }
} }
?>" ?>"
value="<?=TemplaterTools::safeHtmlAttr($field->getValue())?>" value="<?=TemplaterTools::safeHtmlAttr($field->getValue())?>"
maxlength="255" maxlength="255"
placeholder="<?=TemplaterTools::safeHtmlAttr($field->getPlaceholder()).''?>" placeholder="<?=TemplaterTools::safeHtmlAttr($field->getPlaceholder()).''?>"
<? <?php
echo TemplaterTools::getAttrByArray($arParams['ATTR']); echo TemplaterTools::getAttrByArray($arParams['ATTR']);
if($isDatepicker) { if($isDatepicker) {
echo TemplaterTools::getAttrByArray([ echo TemplaterTools::getAttrByArray([
'data-position' => 'bottom left' 'data-position' => 'bottom left'
]); ]);
} }
?> autocomplete="<?=$field->isAutocomplete()?'on':'off'?>"><?php
?> ?>
autocomplete="off"><? <div class="kit-field__hint kit-icon" data-bs-toggle="tooltip" title="<?=TemplaterTools::safeHtmlAttr($field->getTitle())?>"
?> <?php if($field->getTitle() == ''){?>style="display: none;"<?php
<div class="kit-field__hint kit-icon" data-bs-toggle="tooltip" title="<?=TemplaterTools::safeHtmlAttr($field->getTitle())?>" <?if($field->getTitle() == ''){?>style="display: none;"<?}?>> }?>>
<?app()->service()->templater()->render('kit:svg/hint')?> <?php app()->service()->templater()->render('kit:svg/hint')?>
</div> </div>
<div class="kit-field__label"><div class="kit-field__label-content kit-line-clamp"><?=$label;?></div><? <div class="kit-field__label"><div class="kit-field__label-content kit-line-clamp"><?=$label;?></div><?php
if(in_array($field->getType(), ['radio', 'checkbox'])) {?> if(in_array($field->getType(), ['radio', 'checkbox'])) {?>
<span class="kit-field__icon"> <span class="kit-field__icon">
<svg viewBox="0 0 24 24"> <svg viewBox="0 0 24 24">
<?if(0) {?><path d="M9.001,16.212l-4.199-4.2l-1.4,1.4l5.6,5.6l12-12l-1.4-1.4L9.001,16.212z"></path><?}?> <?php if(0) {?><path d="M9.001,16.212l-4.199-4.2l-1.4,1.4l5.6,5.6l12-12l-1.4-1.4L9.001,16.212z"></path><?php
}?>
<path class="kit-field__check-mark" style="mix-blend-mode: normal;fill: none; stroke-width: 3px; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1;" d="m 4.5010925,8.3988745 c 0,0 4.5231587,4.0536025 7.5719575,9.6668315 C 15.906315,10.552955 23.728894,0.8779021 31.09896,-3.72797"></path> <path class="kit-field__check-mark" style="mix-blend-mode: normal;fill: none; stroke-width: 3px; stroke-linecap: butt; stroke-linejoin: miter; stroke-miterlimit: 4; stroke-opacity: 1;" d="m 4.5010925,8.3988745 c 0,0 4.5231587,4.0536025 7.5719575,9.6668315 C 15.906315,10.552955 23.728894,0.8779021 31.09896,-3.72797"></path>
</svg> </svg>
</span> </span>
<? <?php
} }
?></div> ?></div>
<div class="kit-field__color"></div> <div class="kit-field__color"></div>
@@ -83,4 +95,4 @@ if($isDatepicker) {
<div class="kit-field__description"><?=$field->getDescription()?></div> <div class="kit-field__description"><?=$field->getDescription()?></div>
<div class="kit-field__hr"></div> <div class="kit-field__hr"></div>
</label> </label>
<? <?php
+30
View File
@@ -0,0 +1,30 @@
<?php
$formService = app()->service()->form();
$loginField = $formService->field()->text();
$loginField->setLabel('Name');
$loginField->setName('login');
$loginField->setAutocomplete('on');
$passField = $formService->field()->password();
$passField->setLabel('Password');
$passField->setName('password');
$passField->setAutocomplete('on');
$submit = $formService->field()->submit();
$submit->setValue('Send');
global $APPLICATION;
$form = $formService->make([
'name' => 'form_auth',
'method' => 'post',
'target' => 'auth_frame',
'autocomplete' => 'on',
'action' => $APPLICATION->GetCurPage(),
]);
$form->addFields([
$loginField,
$passField,
$submit
]);
$form->render();
+33 -21
View File
@@ -1,6 +1,10 @@
<?require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");?> <?php
<? use Bitrix\Main;
if(\Bitrix\Main\Loader::includeModule('wt.core')) {
require($_SERVER['DOCUMENT_ROOT']. '/bitrix/modules/main/include/prolog_before.php');?>
<?php
try {
if (Main\Loader::includeModule('wt.core')) {
app()->service()->assets()->setPlugins([ app()->service()->assets()->setPlugins([
'kit:config', 'kit:config',
'kit:flex-kit', 'kit:flex-kit',
@@ -12,40 +16,48 @@ if(\Bitrix\Main\Loader::includeModule('wt.core')) {
'kit:theme', 'kit:theme',
])->render(); ])->render();
} }
} catch (Main\LoaderException $e) {
}
global $APPLICATION;
$APPLICATION->ShowHead(); $APPLICATION->ShowHead();
$c = app()->config();
$c['form_field_profile_id'] = 'material';
/** /**
* @param $name * @param $name
* @param $filePath * @param $filePath
*/ */
function includeSection ($name, $filePath){ function include_section ($name, $filePath){
?><div class="kit-section"><h2><?=$name?></h2><? include $filePath; ?></div><? ?><div class="kit-section"><h2><?=$name?></h2><? include $filePath; ?></div><?
} }
?> ?>
<script> <script>
kit.ready(['popover', 'datepicker'], function () { kit.ready(['popover', 'datepicker', 'toolkit'], function () {
}); });
</script> </script>
<div class="kit-wrapper"> <div class="kit-wrapper">
<h1 style="text-align: center;">BX.KIT FRONT-END FRAMEWORK</h1> <h1 style="text-align: center;">BX.KIT FRONT-END FRAMEWORK</h1>
<? <?php
includeSection('Text samples',__DIR__ . '/cheatSheet/text.php'); include_section('Text samples',__DIR__ . '/cheatSheet/text.php');
includeSection('Tooltip',__DIR__ . '/cheatSheet/tooltip.php'); include_section('Tooltip',__DIR__ . '/cheatSheet/tooltip.php');
includeSection('Popover',__DIR__ . '/cheatSheet/popover.php'); include_section('Popover',__DIR__ . '/cheatSheet/popover.php');
includeSection('Modals',__DIR__ . '/cheatSheet/modals.php'); include_section('Modals',__DIR__ . '/cheatSheet/modals.php');
includeSection('Color fields',__DIR__ . '/cheatSheet/field/color.php'); include_section('Color fields',__DIR__ . '/cheatSheet/field/color.php');
includeSection('Tel fields',__DIR__ . '/cheatSheet/field/tel.php'); include_section('Tel fields',__DIR__ . '/cheatSheet/field/tel.php');
includeSection('Number fields',__DIR__ . '/cheatSheet/field/number.php'); include_section('Number fields',__DIR__ . '/cheatSheet/field/number.php');
includeSection('Select fields',__DIR__ . '/cheatSheet/field/select.php'); include_section('Select fields',__DIR__ . '/cheatSheet/field/select.php');
includeSection('Checkbox fields',__DIR__ . '/cheatSheet/field/checkbox.php'); include_section('Checkbox fields',__DIR__ . '/cheatSheet/field/checkbox.php');
includeSection('Radio fields',__DIR__ . '/cheatSheet/field/radio.php'); include_section('Radio fields',__DIR__ . '/cheatSheet/field/radio.php');
includeSection('Text fields',__DIR__ . '/cheatSheet/field/text.php'); include_section('Text fields',__DIR__ . '/cheatSheet/field/text.php');
includeSection('Textarea fields',__DIR__ . '/cheatSheet/field/textarea.php'); include_section('Textarea fields',__DIR__ . '/cheatSheet/field/textarea.php');
includeSection('File fields',__DIR__ . '/cheatSheet/field/file.php'); include_section('File fields',__DIR__ . '/cheatSheet/field/file.php');
includeSection('Buttons',__DIR__ . '/cheatSheet/button/buttons.php'); include_section('Buttons',__DIR__ . '/cheatSheet/button/buttons.php');
include_section('Form',__DIR__ . '/cheatSheet/form.php');
?> ?>
</div> </div>
<? <?php