diginet-core-ui 1.4.53-beta.2 → 1.4.53-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,6 +69,8 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
69
69
  allowNumber: false,
70
70
  allowSymbol: false
71
71
  }));
72
+ const [isChanged, setIsChanged] = useState(false);
73
+ const [isChecked, setIsChecked] = useState(false);
72
74
  const _TreeViewRootCSS = TreeViewRootCSS(theme);
73
75
  const determinateCheckbox = (input, determinate) => {
74
76
  if (multipleValueMode === 'multiple' || disabledRelevantValue) {
@@ -212,7 +214,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
212
214
  el.firstChild.firstChild.lastChild.firstChild.firstChild.firstChild.classList[isChecked ? 'add' : 'remove']('disabled');
213
215
  el.firstChild.firstChild.lastChild.firstChild.firstChild.firstChild.disabled = isChecked;
214
216
  Array.from(el.childNodes).forEach(e => {
215
- e.classList[isChecked ? 'add' : 'remove']('treeview-disabled');
217
+ e.classList[isChecked ? 'add' : 'remove']('disabled');
216
218
  });
217
219
  } else {
218
220
  el.firstChild.firstChild.firstChild.firstChild.disabled = isChecked;
@@ -233,12 +235,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
233
235
  const checkbox = node.firstChild.firstChild.lastChild.firstChild.firstChild.firstChild;
234
236
  if (checkbox) {
235
237
  var _node$querySelectorAl;
236
- // Trường hợp phải set về false để xét các input đã check không bao gồm node này
237
- checkbox.firstChild.checked = isChecked;
238
238
  const mustDisabled = !!((_node$querySelectorAl = node.querySelectorAll('input:checked')) !== null && _node$querySelectorAl !== void 0 && _node$querySelectorAl.length);
239
- // Nếu có ít nhất một input con được check thì phải checked cho input này
240
- checkbox.firstChild.checked = mustDisabled;
241
- determinateCheckbox(checkbox.firstChild, !mustDisabled);
242
239
  node.classList[mustDisabled || isChecked ? 'add' : 'remove']('disabled');
243
240
  checkbox.classList[mustDisabled || isChecked ? 'add' : 'remove']('disabled');
244
241
  Array.from(node.childNodes).forEach(e => {
@@ -246,6 +243,13 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
246
243
  e.classList[mustDisabled || isChecked ? 'add' : 'remove']('treeview-disabled');
247
244
  });
248
245
  });
246
+ setTimeout(() => {
247
+ // Trường hợp phải set về false để xét các input đã check không bao gồm node này
248
+ checkbox.firstChild.checked = isChecked;
249
+ // Nếu có ít nhất một input con được check thì phải checked cho input này
250
+ checkbox.firstChild.checked = mustDisabled;
251
+ determinateCheckbox(checkbox.firstChild, !mustDisabled);
252
+ });
249
253
  }
250
254
  }
251
255
  }
@@ -347,6 +351,8 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
347
351
  } else {
348
352
  currentValue[unique][value] = checked;
349
353
  if (disabledRelevantValue) {
354
+ setIsChanged(!isChanged);
355
+ setIsChecked(checked);
350
356
  // Disabled/Enabled parent and children node
351
357
  if (!currentTarget.classList.contains('non-child')) {
352
358
  handleDisabledChildren(currentTarget.nextElementSibling, checked);
@@ -698,6 +704,20 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
698
704
  }
699
705
  }
700
706
  }, []);
707
+ useEffect(() => {
708
+ if (value && multiple) {
709
+ if (disabledRelevantValue) {
710
+ Array.from(ref.current.querySelectorAll('.TreeView-Item.non-child, .DGN-UI-Accordion')).forEach(el => {
711
+ if (el.firstChild.querySelector('input').checked) {
712
+ if (!el.classList.contains('non-child')) {
713
+ handleDisabledChildren(el, isChecked);
714
+ }
715
+ handleDisabledParent(el.parentNode, isChecked);
716
+ }
717
+ });
718
+ }
719
+ }
720
+ }, [isChanged, isChecked]);
701
721
  useEffect(() => {
702
722
  if (selectAllRef.current) {
703
723
  checkedSelectAllCheckbox();
@@ -806,6 +826,9 @@ const TreeViewRootCSS = ({
806
826
  &.focus {
807
827
  ${bgColor(getProp(colors, 'fill/focus'))};
808
828
  }
829
+ &.disabled {
830
+ ${bgColor(getProp(colors, 'system/white'))};
831
+ }
809
832
  .Accordion-Icon-Root {
810
833
  ${displayFlex};
811
834
  ${flexRow};
package/global/index.js CHANGED
@@ -161,6 +161,86 @@ const globalObject = {
161
161
  inputPlaceholder: 'Type something',
162
162
  dropdownPlaceholder: 'Select'
163
163
  },
164
+ zh: {
165
+ agree: '同意',
166
+ cancel: '取消',
167
+ close: '关闭',
168
+ confirm: '确认',
169
+ error: '错误',
170
+ unknownError: '未知错误',
171
+ no: '否',
172
+ noDataText: '无数据',
173
+ notify: '通知',
174
+ ok: '确定',
175
+ showLess: '收起',
176
+ showMore: '展开',
177
+ yes: '是',
178
+ warning: '警告',
179
+ // attachment
180
+ dropFileHere: '将文件拖到此处',
181
+ deleteNotifyText: '您确定要删除此附件吗?',
182
+ attachText: '附件',
183
+ noFileText: '无附件',
184
+ byName: '按名称',
185
+ byType: '按类型',
186
+ bySize: '按大小',
187
+ byDate: '按日期',
188
+ byOwner: '按所有者',
189
+ errorDefault: {
190
+ maxFile: ' 超过允许的数量!',
191
+ maxSize: ' 文件过大!',
192
+ fileType: ' 文件格式不正确!',
193
+ existingFile: ' 已经添加!'
194
+ },
195
+ // Paging
196
+ lineNumber: '每页条数',
197
+ total: '总计',
198
+ // Transfer
199
+ choices: '可选',
200
+ chosen: '已选',
201
+ selected: '已选择',
202
+ // Date Picker
203
+ helperInvalid: '无效',
204
+ helperValid: '有效',
205
+ label: '时间',
206
+ weekdaysLong: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
207
+ weekdaysShort: ['一', '二', '三', '四', '五', '六', '日'],
208
+ // Daterange Picker
209
+ today: '今天',
210
+ yesterday: '昨天',
211
+ thisWeek: '本周',
212
+ thisMonth: '本月',
213
+ // Time Picker
214
+ months: {
215
+ full: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
216
+ notFull: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
217
+ },
218
+ days: {
219
+ full: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
220
+ notFull: ['日', '一', '二', '三', '四', '五', '六']
221
+ },
222
+ night: '夜',
223
+ day: '日',
224
+ month: '月',
225
+ year: '年',
226
+ save: '保存',
227
+ now: '现在',
228
+ // Localize
229
+ selectAll: '全选',
230
+ thisFieldIsRequired: '此字段为必填项',
231
+ validate: {
232
+ isEmail: '邮箱无效',
233
+ isNotEmptyString: '不能为空',
234
+ isNotEmptyObject: '必须包含至少一个属性',
235
+ isNotEmptyArray: '必须包含至少一个元素',
236
+ invalidInput: '输入值不正确',
237
+ max: '超过允许的最大值',
238
+ min: '未达到允许的最小值',
239
+ required: '此字段为必填项'
240
+ },
241
+ inputPlaceholder: '请输入内容',
242
+ dropdownPlaceholder: '请选择'
243
+ },
164
244
  //Global variable
165
245
  delayOnInput: 500,
166
246
  maxSizeUpload: Infinity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diginet-core-ui",
3
- "version": "1.4.53-beta.2",
3
+ "version": "1.4.53-beta.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "license": "UNLICENSED",