diff --git a/lib/zin/func.php b/lib/zin/func.php index 52b5bf8720..19231a1fb2 100644 --- a/lib/zin/func.php +++ b/lib/zin/func.php @@ -1360,20 +1360,6 @@ function dragUl(): dragUl return createWg('dragUl', func_get_args()); } -/** - * Zentao custom table columns widget. - * - * ?array leftItems - * ?array flexItems - * ?array rightItems - * string url - * ?string method - */ -function editCols(): editCols -{ - return createWg('editCols', func_get_args()); -} - /** * Back btn widget. * diff --git a/lib/zin/wg/editcols/css/v1.css b/lib/zin/wg/editcols/css/v1.css deleted file mode 100644 index 2d32c91e4f..0000000000 --- a/lib/zin/wg/editcols/css/v1.css +++ /dev/null @@ -1,6 +0,0 @@ -.edit-cols .modal-title {flex: none;} -.edit-cols .border:not(:last-child) {border-bottom: none;} -.edit-cols .border {border-color: #D8DBDE;} -.edit-cols .required-col {background: #F4F5F7 !important;} -.edit-cols .required-col input {background: inherit;} -.edit-cols li:hover {background: #E6F0FF;} diff --git a/lib/zin/wg/editcols/v1.php b/lib/zin/wg/editcols/v1.php deleted file mode 100644 index 68dcdcc09b..0000000000 --- a/lib/zin/wg/editcols/v1.php +++ /dev/null @@ -1,150 +0,0 @@ -datatable->width), - input - ( - setClass('w-8', 'h-5', 'shadow-none', 'px-1', 'text-center'), - set::value($item['width']), - ), - span('px'), - ), - ); - } - - private function buildBody() - { - $itemsList = array( - 'left' => $this->prop('leftItems'), - 'flex' => $this->prop('flexItems'), - 'right' => $this->prop('rightItems'), - ); - - $body = form - ( - setClass('col', 'gap-0.5'), - set::grid(false), - set::actions(null), - ); - - foreach($itemsList as $key => $items) - { - if(empty($items)) continue; - - $ul = dragUl(setClass("{$key}-cols")); - foreach ($items as $item) $ul->add($this->onBuildItem($item)); - $body->add($ul); - } - - $body->setProp('data-zin-gid', $body->gid); - $this->formGID = $body->gid; - return $body; - } - - private function submitFunc() - { - $url = $this->prop('url'); - $method = $this->prop('method'); - - return << '[data-zin-gid="{$this->formGID}"] .drag-ul.' + value + '-cols'; - const colsList = types.map(x => document.querySelector(getSelector(x))); - - for(let i = 0; i < colsList.length; i++) - { - const cols = colsList[i]; - if(!cols) continue; - - const children = Array.from(cols.children); - for(let j = 0; j < children.length; j++) - { - const li = children[j]; - const checkbox = li.querySelector('input[type="checkbox"]'); - const input = li.querySelector('input[type="text"]'); - formData.push({ - id: li.dataset.key, - order: ++index, - show: checkbox.checked, - width: input.value + 'px', - fixed: types[i] === 'flex' ? 'no' : types[i], - }); - } - } - - fetch('{$url}', {method: '{$method}', body: JSON.stringify(formData)}) - .then(() => loadTable()); - FUNC; - } - - protected function build() - { - global $lang, $app; - $app->loadLang('datatable'); - - return modalDialog - ( - setClass('edit-cols'), - set::title($lang->datatable->custom), - to::header(span($lang->datatable->customTip, setClass('text-gray', 'text-md'))), - set::footerClass('justify-center'), - $this->buildBody(), - to::footer - ( - toolbar - ( - item - ( - set(array('text' => $lang->save, 'type' => 'primary', 'class' => 'w-28', 'data-dismiss' => 'modal')), - on::click($this->submitFunc()) - ) - ) - ), - ); - } -}