bkui-vue 0.0.1-beta.423 → 0.0.1-beta.424

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.
package/dist/index.esm.js CHANGED
@@ -26332,6 +26332,228 @@ var DateTable = defineComponent({
26332
26332
  }, [createVNode("em", null, [cell.desc])]))]);
26333
26333
  }
26334
26334
  });
26335
+ const monthTableProps = {
26336
+ tableDate: {
26337
+ type: Date,
26338
+ required: true
26339
+ },
26340
+ disabledDate: {
26341
+ type: Function
26342
+ },
26343
+ selectionMode: {
26344
+ type: String,
26345
+ required: true
26346
+ },
26347
+ modelValue: {
26348
+ type: [Date, String, Number, Array],
26349
+ required: true
26350
+ },
26351
+ rangeState: {
26352
+ type: Object,
26353
+ default: () => ({
26354
+ from: null,
26355
+ to: null,
26356
+ selecting: false
26357
+ })
26358
+ },
26359
+ focusedDate: {
26360
+ type: Date,
26361
+ required: true
26362
+ },
26363
+ cellClass: {
26364
+ type: Function,
26365
+ default: () => ""
26366
+ }
26367
+ };
26368
+ var MonthTable = defineComponent({
26369
+ name: "MonthTable",
26370
+ props: monthTableProps,
26371
+ emits: ["pick", "pick-click", "change-range"],
26372
+ setup(props2, {
26373
+ emit
26374
+ }) {
26375
+ const dates = computed(() => {
26376
+ const {
26377
+ selectionMode,
26378
+ modelValue,
26379
+ rangeState
26380
+ } = props2;
26381
+ const rangeSelecting = selectionMode === "range" && rangeState.selecting;
26382
+ return rangeSelecting ? [rangeState.from] : modelValue;
26383
+ });
26384
+ const cells = computed(() => {
26385
+ const cells2 = [];
26386
+ const cellTmpl = {
26387
+ text: "",
26388
+ selected: false,
26389
+ disabled: false
26390
+ };
26391
+ const tableYear = props2.tableDate.getFullYear();
26392
+ const selectedDays = dates.value.filter(Boolean).map((date) => clearHours(new Date(date.getFullYear(), date.getMonth(), 1)));
26393
+ const focusedDate = clearHours(new Date(props2.focusedDate.getFullYear(), props2.focusedDate.getMonth(), 1));
26394
+ for (let i2 = 0; i2 < 12; i2++) {
26395
+ const cell = JSON.parse(JSON.stringify(cellTmpl));
26396
+ cell.date = new Date(tableYear, i2, 1);
26397
+ cell.text = tCell(i2 + 1);
26398
+ const day = clearHours(cell.date);
26399
+ cell.disabled = typeof props2.disabledDate === "function" && props2.disabledDate(cell.date) && props2.selectionMode === "month";
26400
+ cell.selected = selectedDays.includes(day);
26401
+ cell.focused = day === focusedDate;
26402
+ cells2.push(cell);
26403
+ }
26404
+ return cells2;
26405
+ });
26406
+ const tCell = (nr) => String(nr).length > 1 ? nr : `0${nr}`;
26407
+ const getCellCls = (cell) => [resolveClassName("date-picker-cells-cell"), {
26408
+ [resolveClassName("date-picker-cells-cell-selected")]: cell.selected,
26409
+ [resolveClassName("date-picker-cells-cell-disabled")]: cell.disabled,
26410
+ [resolveClassName("date-picker-cells-cell-range")]: cell.range && !cell.start && !cell.end
26411
+ }];
26412
+ const handleClick = (cell) => {
26413
+ if (cell.disabled || cell.type === "weekLabel") {
26414
+ return;
26415
+ }
26416
+ const newDate = new Date(clearHours(cell.date));
26417
+ emit("pick", newDate);
26418
+ emit("pick-click");
26419
+ };
26420
+ const handleMouseMove = (cell) => {
26421
+ if (!props2.rangeState.selecting) {
26422
+ return;
26423
+ }
26424
+ if (cell.disabled) {
26425
+ return;
26426
+ }
26427
+ const newDate = cell.date;
26428
+ emit("change-range", newDate);
26429
+ };
26430
+ return {
26431
+ cells,
26432
+ getCellCls,
26433
+ handleClick,
26434
+ handleMouseMove
26435
+ };
26436
+ },
26437
+ render() {
26438
+ return createVNode("div", {
26439
+ "class": [resolveClassName("date-picker-cells"), resolveClassName("date-picker-cells-month")]
26440
+ }, [this.cells.map((cell) => createVNode("span", {
26441
+ "class": this.getCellCls(cell),
26442
+ "onClick": () => this.handleClick(cell),
26443
+ "onMouseenter": () => this.handleMouseMove(cell)
26444
+ }, [createVNode("em", null, [cell.text])]))]);
26445
+ }
26446
+ });
26447
+ const yearTableProps = {
26448
+ tableDate: {
26449
+ type: Date,
26450
+ required: true
26451
+ },
26452
+ disabledDate: {
26453
+ type: Function
26454
+ },
26455
+ selectionMode: {
26456
+ type: String,
26457
+ required: true
26458
+ },
26459
+ modelValue: {
26460
+ type: [Date, String, Number, Array],
26461
+ required: true
26462
+ },
26463
+ rangeState: {
26464
+ type: Object,
26465
+ default: () => ({
26466
+ from: null,
26467
+ to: null,
26468
+ selecting: false
26469
+ })
26470
+ },
26471
+ focusedDate: {
26472
+ type: Date,
26473
+ required: true
26474
+ },
26475
+ cellClass: {
26476
+ type: Function,
26477
+ default: () => ""
26478
+ }
26479
+ };
26480
+ var YearTable = defineComponent({
26481
+ name: "YearTable",
26482
+ props: yearTableProps,
26483
+ emits: ["pick", "pick-click", "change-range"],
26484
+ setup(props2, {
26485
+ emit
26486
+ }) {
26487
+ const dates = computed(() => {
26488
+ const {
26489
+ selectionMode,
26490
+ modelValue,
26491
+ rangeState
26492
+ } = props2;
26493
+ const rangeSelecting = selectionMode === "range" && rangeState.selecting;
26494
+ return rangeSelecting ? [rangeState.from] : modelValue;
26495
+ });
26496
+ const startYear = computed(() => Math.floor(props2.tableDate.getFullYear() / 10) * 10);
26497
+ const cells = computed(() => {
26498
+ const cells2 = [];
26499
+ const cellTmpl = {
26500
+ text: "",
26501
+ selected: false,
26502
+ disabled: false
26503
+ };
26504
+ const selectedDays = dates.value.filter(Boolean).map((date) => clearHours(new Date(date.getFullYear(), 0, 1)));
26505
+ const focusedDate = clearHours(new Date(props2.focusedDate.getFullYear(), 0, 1));
26506
+ for (let i2 = 0; i2 < 10; i2++) {
26507
+ const cell = JSON.parse(JSON.stringify(cellTmpl));
26508
+ cell.date = new Date(startYear.value + i2, 0, 1);
26509
+ cell.disabled = typeof props2.disabledDate === "function" && props2.disabledDate(cell.date) && props2.selectionMode === "year";
26510
+ const day = clearHours(cell.date);
26511
+ cell.selected = selectedDays.includes(day);
26512
+ cell.focused = day === focusedDate;
26513
+ cells2.push(cell);
26514
+ }
26515
+ return cells2;
26516
+ });
26517
+ const getCellCls = (cell) => [resolveClassName("date-picker-cells-cell"), {
26518
+ [resolveClassName("date-picker-cells-cell-selected")]: cell.selected,
26519
+ [resolveClassName("date-picker-cells-cell-disabled")]: cell.disabled,
26520
+ [resolveClassName("date-picker-cells-cell-range")]: cell.range && !cell.start && !cell.end
26521
+ }];
26522
+ const handleClick = (cell) => {
26523
+ if (cell.disabled || cell.type === "weekLabel") {
26524
+ return;
26525
+ }
26526
+ const newDate = new Date(clearHours(cell.date));
26527
+ emit("pick", newDate);
26528
+ emit("pick-click");
26529
+ };
26530
+ const handleMouseMove = (cell) => {
26531
+ if (!props2.rangeState.selecting) {
26532
+ return;
26533
+ }
26534
+ if (cell.disabled) {
26535
+ return;
26536
+ }
26537
+ const newDate = cell.date;
26538
+ emit("change-range", newDate);
26539
+ };
26540
+ return {
26541
+ cells,
26542
+ getCellCls,
26543
+ handleClick,
26544
+ handleMouseMove
26545
+ };
26546
+ },
26547
+ render() {
26548
+ return createVNode("div", {
26549
+ "class": [resolveClassName("date-picker-cells"), resolveClassName("date-picker-cells-year")]
26550
+ }, [this.cells.map((cell) => createVNode("span", {
26551
+ "class": this.getCellCls(cell),
26552
+ "onClick": () => this.handleClick(cell),
26553
+ "onMouseenter": () => this.handleMouseMove(cell)
26554
+ }, [createVNode("em", null, [cell.date.getFullYear()])]))]);
26555
+ }
26556
+ });
26335
26557
  const datePickerProps = {
26336
26558
  type: {
26337
26559
  type: String,
@@ -27224,7 +27446,8 @@ var DatePanel = defineComponent({
27224
27446
  }, [createVNode(angleDoubleLeft, {
27225
27447
  "style": {
27226
27448
  fontSize: "20px",
27227
- lineHeight: 1
27449
+ lineHeight: 1,
27450
+ verticalAlign: "text-bottom"
27228
27451
  }
27229
27452
  }, null)]), this.pickerTable === "date-table" ? withDirectives(createVNode("span", {
27230
27453
  "class": iconBtnCls("prev"),
@@ -27232,7 +27455,8 @@ var DatePanel = defineComponent({
27232
27455
  }, [createVNode(angleLeft, {
27233
27456
  "style": {
27234
27457
  fontSize: "20px",
27235
- lineHeight: 1
27458
+ lineHeight: 1,
27459
+ verticalAlign: "text-bottom"
27236
27460
  }
27237
27461
  }, null)]), [[vShow, this.currentView === "date"]]) : "", this.datePanelLabel && Object.keys(this.datePanelLabel).length > 0 ? createVNode("span", null, [withDirectives(createVNode("span", {
27238
27462
  "class": resolveClassName("date-picker-header-label"),
@@ -27246,7 +27470,8 @@ var DatePanel = defineComponent({
27246
27470
  }, [createVNode(angleDoubleRight, {
27247
27471
  "style": {
27248
27472
  fontSize: "20px",
27249
- lineHeight: 1
27473
+ lineHeight: 1,
27474
+ verticalAlign: "text-bottom"
27250
27475
  }
27251
27476
  }, null)]), this.pickerTable === "date-table" ? withDirectives(createVNode("span", {
27252
27477
  "class": iconBtnCls("next"),
@@ -27254,7 +27479,8 @@ var DatePanel = defineComponent({
27254
27479
  }, [createVNode(angleRight, {
27255
27480
  "style": {
27256
27481
  fontSize: "20px",
27257
- lineHeight: 1
27482
+ lineHeight: 1,
27483
+ verticalAlign: "text-bottom"
27258
27484
  }
27259
27485
  }, null)]), [[vShow, this.currentView === "date"]]) : ""]), [[vShow, this.currentView !== "time"]]), createVNode("div", {
27260
27486
  "class": resolveClassName("picker-panel-content")
@@ -27269,6 +27495,24 @@ var DatePanel = defineComponent({
27269
27495
  "focusedDate": this.focusedDate,
27270
27496
  "onPick": this.panelPickerHandlers
27271
27497
  }, null);
27498
+ case "year-table":
27499
+ return createVNode(YearTable, {
27500
+ "tableDate": this.panelDate,
27501
+ "disabledDate": this.disabledDate,
27502
+ "selectionMode": this.selectionMode,
27503
+ "modelValue": this.dates,
27504
+ "focusedDate": this.focusedDate,
27505
+ "onPick": this.panelPickerHandlers
27506
+ }, null);
27507
+ case "month-table":
27508
+ return createVNode(MonthTable, {
27509
+ "tableDate": this.panelDate,
27510
+ "disabledDate": this.disabledDate,
27511
+ "selectionMode": this.selectionMode,
27512
+ "modelValue": this.dates,
27513
+ "focusedDate": this.focusedDate,
27514
+ "onPick": this.panelPickerHandlers
27515
+ }, null);
27272
27516
  default:
27273
27517
  return null;
27274
27518
  }
@@ -27851,7 +28095,8 @@ var DateRangePanel = defineComponent({
27851
28095
  }, [createVNode(angleDoubleLeft, {
27852
28096
  "style": {
27853
28097
  fontSize: "20px",
27854
- lineHeight: 1
28098
+ lineHeight: 1,
28099
+ verticalAlign: "text-bottom"
27855
28100
  }
27856
28101
  }, null)]), this.leftPickerTable === "date-table" ? withDirectives(createVNode("span", {
27857
28102
  "class": iconBtnCls("prev"),
@@ -27859,7 +28104,8 @@ var DateRangePanel = defineComponent({
27859
28104
  }, [createVNode(angleLeft, {
27860
28105
  "style": {
27861
28106
  fontSize: "20px",
27862
- lineHeight: 1
28107
+ lineHeight: 1,
28108
+ verticalAlign: "text-bottom"
27863
28109
  }
27864
28110
  }, null)]), [[vShow, this.currentView === "date"]]) : "", this.leftDatePanelLabel && Object.keys(this.leftDatePanelLabel).length > 0 ? createVNode("span", null, [withDirectives(createVNode("span", {
27865
28111
  "class": resolveClassName("date-picker-header-label"),
@@ -27873,7 +28119,8 @@ var DateRangePanel = defineComponent({
27873
28119
  }, [createVNode(angleDoubleRight, {
27874
28120
  "style": {
27875
28121
  fontSize: "20px",
27876
- lineHeight: 1
28122
+ lineHeight: 1,
28123
+ verticalAlign: "text-bottom"
27877
28124
  }
27878
28125
  }, null)]) : "", this.splitPanels || this.leftPickerTable === "date-table" ? withDirectives(createVNode("span", {
27879
28126
  "class": iconBtnCls("next"),
@@ -27881,7 +28128,8 @@ var DateRangePanel = defineComponent({
27881
28128
  }, [createVNode(angleRight, {
27882
28129
  "style": {
27883
28130
  fontSize: "20px",
27884
- lineHeight: 1
28131
+ lineHeight: 1,
28132
+ verticalAlign: "text-bottom"
27885
28133
  }
27886
28134
  }, null)]), [[vShow, this.currentView === "date"]]) : ""]), [[vShow, this.currentView !== "time"]]), this.currentView !== "time" ? (() => {
27887
28135
  switch (this.leftPickerTable) {
@@ -27910,7 +28158,8 @@ var DateRangePanel = defineComponent({
27910
28158
  }, [createVNode(angleDoubleLeft, {
27911
28159
  "style": {
27912
28160
  fontSize: "20px",
27913
- lineHeight: 1
28161
+ lineHeight: 1,
28162
+ verticalAlign: "text-bottom"
27914
28163
  }
27915
28164
  }, null)]) : "", this.splitPanels && this.rightPickerTable === "date-table" ? withDirectives(createVNode("span", {
27916
28165
  "class": iconBtnCls("prev", "-double"),
@@ -27918,7 +28167,8 @@ var DateRangePanel = defineComponent({
27918
28167
  }, [createVNode(angleLeft, {
27919
28168
  "style": {
27920
28169
  fontSize: "20px",
27921
- lineHeight: 1
28170
+ lineHeight: 1,
28171
+ verticalAlign: "text-bottom"
27922
28172
  }
27923
28173
  }, null)]), [[vShow, this.currentView === "date"]]) : "", this.rightDatePanelLabel && Object.keys(this.rightDatePanelLabel).length > 0 ? createVNode("span", null, [withDirectives(createVNode("span", {
27924
28174
  "class": resolveClassName("date-picker-header-label"),
@@ -27942,7 +28192,8 @@ var DateRangePanel = defineComponent({
27942
28192
  }, [createVNode(angleDoubleRight, {
27943
28193
  "style": {
27944
28194
  fontSize: "20px",
27945
- lineHeight: 1
28195
+ lineHeight: 1,
28196
+ verticalAlign: "text-bottom"
27946
28197
  }
27947
28198
  }, null)]), this.rightPickerTable === "date-table" ? withDirectives(createVNode("span", {
27948
28199
  "class": iconBtnCls("next"),
@@ -27950,7 +28201,8 @@ var DateRangePanel = defineComponent({
27950
28201
  }, [createVNode(angleRight, {
27951
28202
  "style": {
27952
28203
  fontSize: "20px",
27953
- lineHeight: 1
28204
+ lineHeight: 1,
28205
+ verticalAlign: "text-bottom"
27954
28206
  }
27955
28207
  }, null)]), [[vShow, this.currentView === "date"]]) : ""]), [[vShow, this.currentView !== "time"]]), this.currentView !== "time" ? (() => {
27956
28208
  switch (this.rightPickerTable) {
@@ -28034,6 +28286,7 @@ var Component$b = defineComponent({
28034
28286
  shortcut,
28035
28287
  onSelectionModeChange
28036
28288
  });
28289
+ onSelectionModeChange(props2.type);
28037
28290
  function onSelectionModeChange(_type) {
28038
28291
  let type = _type;
28039
28292
  if (_type.match(/^date/)) {