v1.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * The thinkMatrixOptions widget class file of zin module of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  6. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Zemei Wang<wangzemei@easycorp.ltd>
  8. * @package zin
  9. * @link http://www.zentao.net
  10. */
  11. namespace zin;
  12. require_once dirname(__DIR__) . DS . 'input' . DS . 'v1.php';
  13. class thinkMatrixOptions extends wg
  14. {
  15. /**
  16. * @var mixed[]
  17. */
  18. protected static $defineProps = array
  19. (
  20. 'id?: string="$GID"', // 组件根元素的 ID。
  21. 'colName?: string="colFields"', // 列数据的名称。
  22. 'cols?: array', // 列数据的默认值。
  23. 'deleteColTip?: string', // 禁用删除提示。
  24. 'addColTip?: string', // 禁用添加提示。
  25. 'addColText: string', // 添加列按钮文字。
  26. 'quotedQuestions?: array', // 引用当前选项的问题。
  27. 'linkColumn?: array' // 关联区块的列
  28. );
  29. public static function getPageJS()
  30. {
  31. return file_get_contents(__DIR__ . DS . 'js' . DS . 'v1.js');
  32. }
  33. public static function getPageCSS()
  34. {
  35. return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css');
  36. }
  37. protected function build()
  38. {
  39. global $lang, $app;
  40. $app->loadLang('thinkstep');
  41. $id = $this->prop('id') ? $this->prop('id') : $this->gid;
  42. $deleteColTip = $this->prop('deleteColTip', $lang->thinkstep->tips->deleteCol);
  43. $addColText = $this->prop('addColText', $lang->thinkstep->addCol);
  44. $addColTip = $this->prop('addColTip', $lang->thinkstep->tips->addCol);
  45. $linkColumn = $this->prop('linkColumn');
  46. return div
  47. (
  48. setID($id),
  49. setClass('think-multiple w-full'),
  50. div(setClass('think-multiple-body flex overflow-x-auto overflow-y-hidden')),
  51. setData('quotedQuestions', $this->prop('quotedQuestions')),
  52. setData('tipQuestion', $lang->thinkstep->tips->question),
  53. setData('cannotDeleteColumnTip', $lang->thinkstep->tips->cannotDeleteColumn),
  54. setData('linkCannotDeleteTip', $lang->thinkstep->tips->linkCannotDeleteTip),
  55. setData('linkColumn', !empty($linkColumn) ? $linkColumn : array()),
  56. zui::thinkMatrixOptions
  57. (
  58. set::_to("#$id"),
  59. set::deleteColTip($deleteColTip),
  60. set::colPlaceholder($lang->thinkstep->label->columnTitle),
  61. set::addColText($addColText),
  62. set::addColTip($addColTip),
  63. set($this->props->pick(array('colName', 'cols')))
  64. )
  65. );
  66. }
  67. }